marc

A better markdown parser and compiler

marc

Markdown as a dynamic template engine

Markdown is a text-to-HTML conversion tool for web writers. With a plain easy-to-write text you can create a website, a blog, a todo list, a slideshow or even a project presentation (like I've done here on github). However it is mostly used to generate static content.

marc makes markdown a dynamic conversion engine with integrated templates that updates automatically when the underlying data changes. It also allows you to create filters or partials and makes easy to create content dynamically from a database.

marc works on both client and server side:

with component:

$ component install bredele/marc

with nodejs:

$ npm install marc

Install globally:

$ npm install -g marc
Usage: marc [<input>] [<output>]
 
Examples:
 
  # pass an input and output file:
  $ marc input.md output.html
  

marc can be initialized with an optional data.

var marc = require('marc')(data);

marc generates html from markdown.

marc('I am using __markdown__.');
//<p>I am using <strong>markdown</strong>.</p> 

marc is also a template engine! It makes markdown less static and allows you to substitute variables (double brackets {{}} with any data.

marc.set('label', 'marc!');
marc('I am using __markdown__ with {{label}}.', true);
//<p>I am using <strong>markdown</strong> with marc!.</p> 

marc makes your markdown dynamic! It updates automatically when the underlying data changes.

marc('I am using __narkdown__ with {{label}}.', function(val) {
  //<p>I am using <strong>markdown</strong> with marc!.</p> 
  //<p>I am using <strong>markdown</strong> with github.</p>  
});
 
marc.set('label', 'marc!');
marc.set('label', 'github');

marc allows you to use partials ({> name })

marc.partial('hello', '__{{ label }}__!');
marc('This is a partial: {> hello }.', function(val){
  //<p>This is a partial: <strong>hello world</strong>!</p> 
});
 
marc.set('label', 'hello world');

marc allows you to apply filter(s) to your markdown in a unix-like fashion.

marc.filter('hello', function(str) {
  return 'hello ' + str + '!';
});
marc('# {{ name } | hello}.', true);
//<h1>hello world!.</h1> 

filters can be chained and reused multiple times.