Parcel 2 plugin for loader markdown string, markdown output HTML.
⚠️
=>parcel-plugin-markdown-stringparcel-transformer-markdown
- parcel-plugin-markdown-string+ parcel-transformer-markdownInstall the plugin
npminstall parcel-transformer-markdown --save-dev.parcelrc
{"extends":"@parcel/config-default","transformers":{"*.md":["parcel-transformer-markdown"]}}index.html:
<!DOCTYPEhtml><divid="root"></div><scripttype="module"src="index.js"></script>Output HTML string
Import your markdown files! Output HTML string.
importHTMLStrfrom'./Markdown.md';console.log(HTMLStr)// => Output HTML string.document.body.innerHTML=HTMLStr;Output Markdown string
// .markedrc{"marked":false}importstrfrom'./Markdown.md';console.log(str)// => Output Markdown string.document.body.innerHTML= str;Marked can be configured using a.markedrc,.markedrc.js, ormarked.config.js file. See theMarked API Reference for details on the available options.
Note:
.markedrc.jsandmarked.config.jsare supported for JavaScript-based configuration, but should be avoided when possible because they reduce the effectiveness of Parcel's caching. Use a JSON based configuration format (e.g..markedrc) instead.
There is amarked configuration that convertsmarkdown toHTML. Otherwise just read themarkdown string.
{"marked":{"breaks":true,"pedantic":false,"gfm":true,"tables":true,"sanitize":false,"smartLists":true,"smartypants":false,"xhtml":false}}As always, thanks to our amazing contributors!
Made withgithub-action-contributors.
MIT ©Kenny Wong