markdown-tag

0.2.2 • Public • Published

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.

Package Sidebar

Install

npm i markdown-tag

Weekly Downloads

1

Version

0.2.2

License

MIT

Last publish

Collaborators

  • marcopeg