md8

1.1.0 • Public • Published

md8: convert Markdown into HTML

md8 support math plugin syntax for pandoc and gitlab .

Example 1

File : ex1.js

const md8 = require('md8')
 
let html = md8.toHtml(`
# Chapter
 
## Section 1
 
A link to [YouTube](http://tw.youtube.com) that you may click
 
![Image1](../img/image.jpg)
 
## Math
 
Support pandoc and gitlab extension
 
### Pandoc syntax
 
An embedded $\int f(x) dx$ math expression.
 
$$
\int f(x) dx
$$
 
### Gitlab syntax
 
An embedded $\`\int f(x) dx\`$ math expression.
 
\`\`\`math
\int f(x) dx
\`\`\`
 
## Conclustion
 
End
`)
 
console.log(html)

Run:

$ node ex1.js

<h1> Chapter</h1>

<h2> Section 1</h2>

<p>A link to <a href="http://tw.youtube.com" alt="">YouTube</a> that you may click</p>

<p><figure>
  <img src="../img/image.jpg" alt=""></img>
<figcaption>Image1</figcaption></figure>
</p>

<h2> Math</h2>

<p>Support pandoc and gitlab extension</p>

<h3> Pandoc syntax</h3>

<p>An embedded \(int f(x) dx\) math expression.</p>

\[int f(x) dx\]

<h3> Gitlab syntax</h3>

<p>An embedded \(int f(x) dx\) math expression.</p>

\[int f(x) dx\]

<h2> Conclustion</h2>

<p>End</p>
<p></p>

Show Math in Browser

You may use MathJax or KaTex to render the output html of md8.

The MathJax Example:

<script>
MathJax = {
  tex: {
    inlineMath: [['\\(', '\\)']],
    displayMath: [ ['\\[','\\]'] ]
  }
}
</script> 
 
 
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
 
...

Package Sidebar

Install

npm i md8

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

25 kB

Total Files

9

Last publish

Collaborators

  • ccckmit