A parser of Markdown and a render to html
npm install markdown2html-proA parser of Markdown and a render to html, written in typescript, that aims for preview-code , which is published as an extension on Visual Studio Code to preview Markdown, ReStructured Text, HTML, Jade, Pug or Mermaid files, Image's URI or CSS while editing them in VSCode.
It is built on top of [markdown-it],
a [CommonMark] markdown parser. You can use markdown2html-pro:
markdown2html-pro is the thing that parses package READMEs on
http://www.npmjs.com. If you see a markdown parsing bug there,
[file an issue here]!
[file an issue here]: https://github.com/searKing/markdown2html-pro/issues
[GitHub-style markdown]: https://help.github.com/articles/basic-writing-and-formatting-syntax/
[CommonMark]: http://spec.commonmark.org/
[markdown-it]: https://github.com/markdown-it/markdown-it
[programmatically in NodeJS]: #Using this module in other modules
An extension to preview Markdown, ReStructured Text, HTML, Jade, Pug or Mermaid files, Image's URI or CSS while editing them in VSCode
``sh`
npm install markdown2html-pro --save
Here is a quick example of how this module can be used in other modules. The TypeScript Module Resolution Logic makes it quite easy. The file src/index.ts is a barrel that re-exports selected exports from other files. The _package.json_ file contains main attribute that points to the generated lib/index.js file and typings attribute that points to the generated lib/index.d.ts file.
> If you are planning to have code in multiple files (which is quite natural for a NodeJS module) that users can import, make sure you update src/index.ts file appropriately.
Now assuming you have published this amazing module to _npm_ with the name markdown2html-pro, and installed it in the module in which you need it -
- To use the Markdown2HtmlPro class in a TypeScript file -
`ts`
import { Markdown2HtmlPro } from "markdown2html-pro";
const markdownContent = "";
const markdown2htmlPro = new Markdown2HtmlPro();
markdown2htmlPro.markdown2html(markdownContent);
- To use the Markdown2HtmlPro class in a JavaScript file -
`js
const Markdown2HtmlPro = require('markdown2html-pro').Markdown2HtmlPro;
const markdownContent = "";
const markdown2htmlPro = new Markdown2HtmlPro();
markdown2htmlPro.markdown2html(markdownContent);
`
markdown2html-pro exports a single function. For basic use, that function
takes a single argument: a string to convert.
`js`
var marky = require("markdown2html-pro")
var html = marky("# hello, I'm markdown")
`sh``
npm install
npm test