|
1 | 1 | # markdown-it-html-entities |
2 | 2 |
|
3 | 3 | Currently [markdown-it](https://github.com/markdown-it/markdown-it) follows |
4 | | -[CommonMark specs](https://spec.commonmark.org) which requires HTML Entity |
| 4 | +[CommonMark specs](https://spec.commonmark.org) which requires HTML Entities |
5 | 5 | [replacement with Unicode |
6 | | -Character](https://spec.commonmark.org/0.28/#entity-references), though in the |
7 | | -Browsers [HTML |
8 | | -entities](https://developer.mozilla.org/en-US/docs/Glossary/Entity) are |
9 | | -displayed using relevant characters. |
| 6 | +Characters](https://spec.commonmark.org/0.28/#entity-references) and currently |
| 7 | +there is no native way to disable [HTML |
| 8 | +Entities](https://developer.mozilla.org/en-US/docs/Glossary/Entity) autoconvertion. |
10 | 9 |
|
11 | | -This plugin is for disabling the HTML Entities to Unicode convertion for |
12 | | -markdown-it. |
| 10 | +This plugin disables the automatic HTML Entities to Unicode convertion in |
| 11 | +markdown-it and let the browser display expected character using HTML Entities |
| 12 | +accordingly, avoiding unexpected character convertion which might not play well |
| 13 | +if you would like to integrate the Markdown output with the system that expect |
| 14 | +HTML Entities and in general it's just adding support for using HTML Entities in |
| 15 | +the Markdown. |
| 16 | + |
| 17 | +## Installation |
| 18 | + |
| 19 | +```bash |
| 20 | +npm i markdown-it-html-entities |
| 21 | +``` |
13 | 22 |
|
14 | 23 | ## Usage |
15 | 24 |
|
16 | 25 | ```js |
17 | | -``` |
| 26 | +const markdownIt = require("markdown-it"); |
| 27 | +const htmlEntities = require("markdown-it-html-entities"); |
| 28 | + |
| 29 | +const markdown = markdownIt().use(htmlEntities); |
18 | 30 |
|
19 | | -## Example |
| 31 | +const result = markdown.render("curly { & } brackets"); |
| 32 | +console.log(result); // <p>curly { & } brackets</p> |
| 33 | +``` |
0 commit comments