Skip to content

mdastic@0.2.0

Choose a tag to compare

@remorses remorses released this 26 Oct 19:33
· 135 commits to main since this release
  1. New opt-in math syntax. Parse and serialize $x$ inline math and $$ blocks with the same nodes, positions and markdown as remark-math:

    import { parse, stringify } from 'mdastic'
    import { math } from 'mdastic/math'
    
    const syntax = [math()]
    const tree = parse('Energy: $E = mc^2$', { syntax })
    if (tree instanceof Error) throw tree
    const markdown = stringify(tree, { syntax })

    Use math({ singleDollarTextMath: false }) to require at least two dollars for inline math. Without math(), dollar signs remain ordinary text.

Thanks @rgodha24 for #10!