unified

Project: bizen241/remark-inline-math

Package: @bizen241/remark-inline-math@0.3.0

  1. Inline math support for remark
  1. remark 213
  2. markdown 153
  3. plugin 137

remark-inline-math

Build Status

This is a remark plugin to support inline math surrounded by dollar signs.

Usage

const unified = require('unified');
const parse = require('remark-parse');
const remarkInlineMath = require('@bizen241/remark-inline-math');

const doc = '$1\\$ = 1$';
const ast = unified()
    .use(parse)
    .use(remarkInlineMath)
    .parse(doc);

Yields:

{
    "type": "root",
    "children": [
        {
            "type": "paragraph",
            "children": [
                {
                    "type": "inlineCode",
                    "value": "1\\$ = 1",
                    "data": {
                        "lang": "math"
                    }
                }
            ]
        }
    ]
}

or

<p><code>1\$ = 1</code></p>

API

origin.use(remarkInlineMath[, options])

options

Example:

const options = {
    builder: (value) => ({
        type: 'inlineCode',
        value,
        data: {
            hName: 'math',
        },
    }),
};

License

MIT © bizen241