@pimd/classes-plugin
v0.1.6
Published
Adds classes to HTML elements
Downloads
3
Readme
PIMD Classes Plugin
Adds HTML classes to code blocks and other elements.
Example usage
# Headline <?: .my-headline ?>
```html .my-code
<p>Example</p>
```
Lorem ipsum dolor sit amet. <?: .my-paragraph ?>
Results in:
<h1 class="my-headline">Headline</h1>
<div class="pimd-example my-code">
...
</div>
<p class="my-paragraph">Lorem ipsum dolor sit amet.</p>
Setup
npm i pimd @pimd/classes-plugin
const { Document } = require("pimd")
const Config = require("pimd/lib/config")
const classesPlugin = require("@pimd/classes-plugin")
const config = new Config()
config.use(classesPlugin)
const markdown = `
# Headline <?: .my-headline ?>
\`\`\`html .my-code
<p>Example</p>
\`\`\`
Lorem ipsum dolor sit amet. <?: .my-paragraph ?>
`
const doc = new Document(markdown, config)
console.log(doc.render())
Copyright
Copyright 2018++ Nico Hagenburger. See MIT-LICENSE for details. Get in touch with @hagenburger on Twitter or open an issue.