parcel-transformer-markdown
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

parcel-transformer-markdown

Buy me a coffee NPM Downloads Build & Deploy parcel-transformer-markdown version parcel-plugin-markdown-string version

Parcel 2 plugin for loader markdown string, markdown output HTML.

⚠️ parcel-plugin-markdown-string => parcel-transformer-markdown

- parcel-plugin-markdown-string 
+ parcel-transformer-markdown

Example usage

Install the plugin

npm install parcel-transformer-markdown --save-dev

.parcelrc

{
  "extends": "@parcel/config-default",
  "transformers": {
    "*.md": [ "parcel-transformer-markdown" ]
  }
}

index.html:

<!DOCTYPE html>
<div id="root"></div>
<script type="module" src="index.js"></script>

Output HTML string

Import your markdown files! Output HTML string.

import HTMLStr from './Markdown.md';

console.log(HTMLStr) // => Output HTML string.
document.body.innerHTML = HTMLStr;

Output Markdown string

// .markedrc
{
  "marked": false
}
import str from './Markdown.md';

console.log(str) // => Output Markdown string.
document.body.innerHTML = str;

Configuration

Marked can be configured using a .markedrc, .markedrc.js, or marked.config.js file. See the Marked API Reference for details on the available options.

Note: .markedrc.js and marked.config.js are 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 a marked configuration that converts markdown to HTML. Otherwise just read the markdown string.

{
  "marked": {
    "breaks": true,
    "pedantic": false,
    "gfm": true,
    "tables": true,
    "sanitize": false,
    "smartLists": true,
    "smartypants": false,
    "xhtml": false
  }
}

Contributors

As always, thanks to our amazing contributors!

Made with github-action-contributors.

License

MIT © Kenny Wong

Package Sidebar

Install

npm i parcel-transformer-markdown

Weekly Downloads

164

Version

3.0.1

License

MIT

Unpacked Size

12.5 kB

Total Files

8

Last publish

Collaborators

  • wcjiang