Skip to content

flowdown 0.9.0

Choose a tag to compare

@github-actions github-actions released this 22 Nov 00:05
· 1 commit to main since this release
28f2a10

Minor Changes

  • 1bb649e: Formulas and diagrams are built in, with no dependency.

    • Math is MathML. @localix-ai/flowdown/math writes $…$, $$…$$ and ```math as
      MathML the browser lays out itself (@localix-ai/math, 11 KB), nine times faster than KaTeX on the
      formulas agents write. Import @localix-ai/flowdown/math.css (the math font) in place of KaTeX's
      stylesheet, and drop the katex dependency: it is no longer a peer. A formula is now
      <span class="fd-math"> (with fd-math-display for a display formula) around a <math>; a page
      that styled .katex styles .fd-math. A formula cut off or with an unknown command is drawn as far
      as it goes, never an error.
    • Diagrams without Mermaid. <Markdown mermaid> (true) draws ```mermaid fences with
      @localix-ai/diagram: every kind Mermaid has, as modern SVG in the page's colours, fetched with the
      first diagram, over 20 times faster than Mermaid and 56 KB against its 1.6 MB. A loader
      (() => import('mermaid')) still draws with Mermaid. builtInDiagrams is exported from
      @localix-ai/flowdown/mermaid for a frame of your own.
    • The terminal reads formulas with the same parser as a page: every environment, typefaces as
      Unicode's math letters, braces with their labels, \xrightarrow.

Patch Changes

  • A code block still being written now draws, at every character, what one parse of it draws: its
    language's escapes and character references are resolved as they are once it closes
    (```foo\+bar names foo+bar), and a block of one empty line keeps that line. Every example of
    CommonMark's and GitHub's specifications is now fed to the renderer a character at a time, and
    every frame, streaming and finished, must be what one parse of that frame draws.
  • A token costs less of the main thread: a reply is compared with the last one once, not four
    times. The document checks it and hands what it checked down, so the scan for an open fence,
    the splitter, a growing fence and its colourer, and a long list or quote compare only what is
    new. The reply is no longer scanned for \r three times a token, a fence still being written is
    no longer searched whole for a form's [!, and a block with no < before a letter is no longer
    parsed only to learn that it has no HTML. A long fence, the dialect's forms and a long report
    stream in less main-thread time. Nothing drawn changes: a page that is edited, cut back or
    regenerated while it streams draws, at every step, what a new page draws.
  • @localix-ai/flowdown/document exports grownOf(block): what the document checked of its last
    block against the last update's. A renderer of its own passes it to growingFence as grown.