happy-mark
markdown to js ast parser
Last updated 2 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install happy-mark 
SYNC missed versions from official npm registry.

Happy Mark License NPM version Build Status

image

Markdown to JS AST parser.

Install

npm i happy-mark --save

How to use?

Binary

cat README.md | happy-mark

For full loop use (format detected automatically):

cat README.md | happy-mark | happy-mark

Reference

Happy Mark converts Markdown to JavaScript this way:

Markdown Becomes
# Heading heading(1, 'Heading')
Some text paragraph('Some text')
**bold** paragraph(bold('bold'))
- one\n- two ul(li('one'), li('two'))
> quote blockquote(paragraph('quote'))
![alt](url) paragraph(image('alt', 'url'))
[text](url) link('text', 'url')

API

import {
    convertMarkdownToJs,
    convertJsToMarkdown,
} from 'happy-mark';
import {montag} from 'montag';

const source = montag`
    # hello
    
    Hello world
    
    \`\`\`js
    const a = 3;
    \`\`\`
`;

const js = convertMarkdownToJs(source);

// returns
`
[
    header(1, 'hello'),
    paragraph('Hello world'),
    codeblock('js', 'const a = 3;'),
];
`;

convertJsToMarkdown(js);
// returns
`
    # hello
    
    Hello world
    
    \`\`\`js
    const a = 3;
    \`\`\`
`;

License

MIT

Current Tags

  • 1.9.1                                ...           latest (2 months ago)

26 Versions

  • 1.9.1                                ...           2 months ago
  • 1.9.0                                ...           3 months ago
  • 1.8.0                                ...           3 months ago
  • 1.7.1                                ...           4 months ago
  • 1.7.0                                ...           5 months ago
  • 1.6.0                                ...           5 months ago
  • 1.5.0                                ...           5 months ago
  • 1.4.0                                ...           5 months ago
  • 1.3.0                                ...           5 months ago
  • 1.2.0                                ...           5 months ago
  • 1.1.2                                ...           5 months ago
  • 1.1.1                                ...           5 months ago
  • 1.1.0                                ...           5 months ago
  • 1.0.12                                ...           5 months ago
  • 1.0.11                                ...           5 months ago
  • 1.0.10                                ...           5 months ago
  • 1.0.9                                ...           5 months ago
  • 1.0.8                                ...           5 months ago
  • 1.0.7                                ...           5 months ago
  • 1.0.6                                ...           5 months ago
  • 1.0.5                                ...           5 months ago
  • 1.0.4                                ...           5 months ago
  • 1.0.3                                ...           5 months ago
  • 1.0.2                                ...           5 months ago
  • 1.0.1                                ...           6 months ago
  • 1.0.0                                ...           6 months ago
Maintainers (1)
Downloads
Total 86
Today 0
This Week 0
This Month 86
Last Day 0
Last Week 7
Last Month 0
Dependencies (8)
Dev Dependencies (14)

© 2010 - cnpmjs.org x YWFE | Home | YWFE