0.2.2 • Published 11 years ago

markdown-tag v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
11 years ago

Markdown Tag

It parse one or more tag delimited Markdown areas from a text source.
This way you can put little Markdown portions into your big HTML page.

Usage

I mostly use this utility in GruntJS tasks combined with the grunt-contrib-copy module.

index.html

<html>
    ...
    <body>
        ...
        
        <markdown-tag>
        My _Markdown_ text
        </markdown-tag>
        
        ...
        
        <markdown-tag>
        ## another piece
        </markdown-tag>
        
        ...
    </body>
<html>

script.js

var fs = require('fs');
var markdownTag = require('markdown-tag');

var html = markdownTag(fs.readFileSync('index.html', 'utf8'));

Custom Delimiters

With version 0.2.0 you can specify your custom delimiters.

Take a look at the following chunk of HTML page:

<!-- Markdown -->
my **Markdown** _template_
<!-- /Markdown -->

then you can parse it this way:

markdownTag(html, '<!-- Markdown -->', '<!-- /Markdown -->');

Tests

I wrote some basic tests for this utility. In order to run the tests you need GruntJS to be installed globally in your machine.

npm install && grunt

Parsed with Marked

So far I use Marked for the real Markdown parsing but I'm looking for a parser which accept a little more expanded syntax.

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago