angel_markdown 1.0.0+1



Markdown view generator for Angel.

With this plug-in, you can easily serve static sites without doing more than writing simple Markdown. Thus, it is a friendly choice for writing API documentation or other tedious HTML-writing tasks.


In your pubspec.yaml:

  angel_framework: ^1.0.0
  angel_markdown: ^1.0.0


It's very straightforward to configure an Angel server to use Markdown:

configureServer(Angel app) async {
  await app.configure(markdown(
    // The directory where your views are located.
    new Directory('views'),

You can then generate HTML on-the-fly in a request handler. Assuming your view directory contained a file named, the following would render it as an HTML response:

configureServer(Angel app) async {
  app.get('/hello', (res) => res.render('hello'));

package:angel_markdown by default searches for files with a .md extension; however, you can easily override this.


angel_markdown can interpolate the values of data from locals before building the Markdown.

For example, with the following template

# Species: {{}}
The species *{{}} {{}}* is fascinating...

You can render as follows:

requestHandler(ResponseContext res) {
  return res.render('species', {
    'species': new Species('sapiens', genius: 'homo')

To disable interpolation for a single bracket, prefix it with an @, ex: @{{raw | not_interpolated | angular}}.


Markdown is frequently used to build the content of sites, but not the templates. You might want to wrap the content of pages in a custom template to apply pretty CSS and JS, etc:

configureServer(Angel app) async {
  await app.configure(
        // The directory where your views are located.
        new Directory('views'), template: (content, Map locals) {
      return '''<!DOCTYPE html>
        <title>${locals['title']} - My Site</title>

The template function will have access to whatever values were passed to the renderer, or an empty Map.

Enhancing Markdown

You can pass an extensionSet to add additional features to the Markdown renderer. By default, this plug-in configures it to enable Github-flavored Markdown.

1. Depend on it

Add this to your package's pubspec.yaml file:

  angel_markdown: "^1.0.0+1"

2. Install it

You can install packages from the command line:

$ pub get

Alternatively, your editor might support 'pub get'. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:angel_markdown/angel_markdown.dart';


Markdown view generator for Angel.


Email Tobe O



Source code (hyperlinked)



Aug 13, 2017