UNPKG

@vivliostyle/vfm

Version:

Custom Markdown syntax specialized in book authoring.

32 lines (31 loc) 934 B
import raw from 'rehype-raw'; import remark2rehype from 'remark-rehype'; import { handler as code } from './plugins/code.js'; import { hast as figure } from './plugins/figure.js'; import { hast as footnotes } from './plugins/footnotes.js'; import { handlerDisplayMath as displayMath, handlerInlineMath as inlineMath, } from './plugins/math.js'; import { handler as ruby } from './plugins/ruby.js'; import { inspect } from './utils.js'; /** * Create Hypertext AST handlers and transformers. * @param options Options for rehype transformers. * @returns Handlers and transformers. */ export const reviveRehype = (options) => [ [ remark2rehype, { allowDangerousHtml: true, handlers: { displayMath, inlineMath, ruby, code, }, }, ], raw, [figure, options], footnotes, inspect('hast'), ];