1
1
Fork
You've already forked md.js
0
A fork of md.js specifically for use with Feather Wiki
  • JavaScript 98.1%
  • HTML 1.9%
Find a file
Sultan Tarimo faefc6f951 v0.2.6
2017年01月10日 16:21:11 +03:00
examples handle XSS edge case 2016年12月02日 20:12:38 +02:00
tests v0.2.6 2017年01月10日 16:21:11 +03:00
.gitattributes init 2016年11月19日 17:58:28 +02:00
.gitignore init 2016年11月19日 17:58:28 +02:00
.npmignore init 2016年11月19日 17:58:28 +02:00
CHANGELOG.md v0.2.6 2017年01月10日 16:21:11 +03:00
LICENSE.md init 2016年11月19日 17:58:28 +02:00
md.js v0.2.6 2017年01月10日 16:21:11 +03:00
md.min.js v0.2.6 2017年01月10日 16:21:11 +03:00
package.json v0.2.6 2017年01月10日 16:21:11 +03:00
README.md v0.2.6 2017年01月10日 16:21:11 +03:00

MD.js

  • ~1kb minified+gzipped
  • ~1.5kb minified

npm licence

MD is a lightweight markdown parser with default support for langauge specific code blocks and XSS filtering, for example

// replace . with `
```javascript
	var int = 0;

will output the following
```html
<pre><code class="language-javascript">
	var int = 0;
</code></pre>

XSS attempt <script>alert(1);</script> will be converted to &lt;script&gt;alert(1)&lt;/script&gt; while <a href="javascript:alert('xss')"></a> will be converted to <a href="#javascript&#58;alert('xss')"></a> and <img onerror="alert(1)"> inline events will be remove and more.

Browser Support

  • Edge
  • IE 8+
  • Chrome
  • Firefox
  • Safari

Installation

direct download

<script src=md.min.js></script>

CDN

<script src=https://unpkg.com/md.js@0.2.6/md.min.js></script>

npm

npm install md.js --save

Useage

md('# Heading...');

Examples

demo