unified

Project:remarkjs/remark-midas

Package:remark-midas@5.1.1

  1. Dependencies:2·Dependents:1
  2. remark plugin to highlight CSS code blocks with midas
  1. remark 170
  2. unified 132
  3. plugin 88
  4. markdown 80
  5. mdast 68
  6. syntax 29
  7. css 9
  8. highlight 4

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.

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, organisation, or community you agree to abide by its terms.

License

MIT © Ben Briggs