unified

Project: remarkjs/remark-midas

Package: remark-midas@6.0.0

  1. Dependencies: 2·Dependents: 0
  2. remark plugin to highlight CSS code blocks with midas
  1. remark 182
  2. unified 143
  3. plugin 130
  4. markdown 104
  5. remark-plugin 72
  6. mdast 72
  7. syntax 27
  8. css 10
  9. highlight 8

remark-midas

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to highlight CSS code blocks with midas.

Install

npm:

npm install remark-midas

Use

Say we have the following file, example.md:

```css
h1 {
  color: red;
}
```

And our script, example.js, looks as follows:

const vfile = require('to-vfile')
const report = require('vfile-reporter')
const unified = require('unified')
const markdown = require('remark-parse')
const midas = require('remark-midas')
const remark2rehype = require('remark-rehype')
const html = require('rehype-stringify')

unified()
  .use(markdown)
  .use(midas)
  .use(remark2rehype)
  .use(html)
  .process(vfile.readSync('example.md'), (err, file) => {
    console.error(report(err || file))
    console.log(String(file))
  })

Now, running node example yields:

example.md: no issues found
<pre><code class="language-css midas"><span class="midas__selector"><span class="midas__tag">h1</span></span> <span class="midas__brace">{</span>
  <span class="midas__property">color</span><span class="midas__colon">: </span><span class="midas__value"><span class="midas__word">red</span></span><span class="midas__semicolon">;</span>
<span class="midas__brace">}</span></code></pre>

API

remark().use(midas)

Highlight CSS code blocks with midas.

Security

Use of remark-midas should be safe to use as midas should be safe to use. When in doubt, use rehype-sanitize.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Ben Briggs