md-parser

Markdown parser

Usage no npm install needed!

<script type="module">
  import mdParser from 'https://cdn.skypack.dev/md-parser';
</script>

README

Markdown JavaScript Parser

This module is under construction (Parsing URLs only)

[I'm an inline-style link](https://www.google.com)

[I'm an inline-style link with title](https://www.google.com "Google's Homepage")

[I'm a reference-style link][Arbitrary case-insensitive reference text]

[I'm a relative reference to a repository file](../blob/master/LICENSE)

[You can use numbers for reference-style link definitions][1]

[another num ref][1]

Or leave it empty and use the [link text itself].

URLs and URLs in angle brackets will automatically get turned into links. 
http://www.example.com or <http://www.example.com> and sometimes 
example.com (but not on Github, for example).

Some text to show that the reference links can follow later [cool].

[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org "title"
[link text itself]: http://www.reddit.com

(Most of the markdown is taken from here)

var mdParser = require('./index.js');
var markdown = "[I'm an inline-style link](https://www.google.com/aa/a)\n\n[I'm an inline-style link with title](https://www.google.com \"Google's Homepage\")\n\n[I'm a reference-style link][Arbitrary case-insensitive reference text]\n\n[I'm a relative reference to a repository file](../blob/master/LICENSE)\n\n[You can use numbers for reference-style link definitions][1]\n\n[another num ref][1]\n\nOr leave it empty and use the [link text itself].\n\nURLs and URLs in angle brackets will automatically get turned into links. \nhttp:\/\/www.example.com or <http:\/\/www.example.com> and sometimes \nexample.com (but not on Github, for example).\n\nSome text to show that the reference links can follow later [cool].\n\n[arbitrary case-insensitive reference text]: https:\/\/www.mozilla.org \n[1]: http:\/\/slashdot.org \"title\"\n[link text itself]: http:\/\/www.reddit.com\n";

console.log(mdParser.parse(markdown));

Output:

<a href="https://www.google.com/aa/a" target="_blank" title="">I'm an inline-style link</a>
<a href="https://www.google.com" target="_blank" title="Google's Homepage">I'm an inline-style link with title</a>
<a href="https://www.mozilla.org" target="_blank" title="">I'm a reference-style link</a>
<a href="../blob/master/LICENSE" target="_blank" title="">I'm a relative reference to a repository file</a>
<a href="http://slashdot.org" target="_blank" title="title">You can use numbers for reference-style link definitions</a>
<a href="http://slashdot.org" target="_blank" title="title">another num ref</a>
Or leave it empty and use the <a href="http://www.reddit.com" target="_blank" title="">link text itself</a>.
URLs and URLs in angle brackets will automatically get turned into links. <a href="www.example.com" target="_blank" title="">www.example.com</a>or <a href="www.example.com" target="_blank" title="">www.example.com</a> and sometimes 
example.com (but not on Github, for example).
Some text to show that the reference links can follow later [cool].