1.0.0 • Published 4 years ago

markdown-it-tex-webcomponents v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

markdown-it-tex-webcomponents

中文指南

markdown-it plugin. Base on markdown-it-texmath. Support the componentization of block tex and inline tex. Make it more convenient to work with web frameworks like Vue to parse later.

Install

npm i markdown-it-tex-webcomponents

API

const md = require('markdown-it')()
  .use(require('markdown-it-tex-webcomponents'), { tag: 'my-tex' });
  • tag: Tag name for componentization

Text following:

`code here`

    code there
```js
code everywhere
```
```
hello world!
```

Will be converted to:

<p><my-code inline="">code here</my-code></p>
<my-code>code there
</my-code>
<my-code lang="js">code everywhere
</my-code>
<my-code>hello world!
</my-code>

Example

const md = require('markdown-it')()
  .use(require('markdown-it-code-webcomponents'), { tag: 'my-code' });

console.dir(md.render('`code here`\n\n    code there\n```js\ncode everywhere\n```\n```\nhello world!\n```'));

/* output

<p><my-code inline="">code here</my-code></p>
<my-code>code there
</my-code>
<my-code lang="js">code everywhere
</my-code>
<my-code>hello world!
</my-code>

*/

More examples can be found in test.js.

License

MIT

Copyright (c) 2020, lookas