🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

md-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

md-parser

Markdown parser

1.0.0
latest
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

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].

Keywords

markdown

FAQs

Package last updated on 10 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts