Code, diagrams and math

Last updated Screenshots show Folora 0.2.0.

In writing view, code blocks are highlighted by language, Mermaid code is shown as a diagram, and LaTeX formulas are shown typeset.

Code blocks

  1. Click Code block in the formatting toolbar.
  2. Choose a language in Code language. The block is highlighted for that language.

The code block’s handle moves or copies the whole block. Blocks longer than 1,500 lines are not highlighted.

Mermaid diagrams

A code block with the language set to mermaid is shown as a diagram. When the cursor moves into the diagram, the source appears above and a live preview below. If the syntax has an error, a line of text below describes it, and the last correct diagram stays.

A Mermaid block being edited: the source above, a flowchart preview below
A Mermaid block being edited: the source above, a flowchart preview below

Math

  • Inline math: $…$ or \(…\).
  • Block math: $$…$$ or \[…\].

When the cursor moves into a formula, the formula expands to its source, which you can edit directly.

Inline and block formulas in a document, with one formula expanded to its source
Inline and block formulas in a document, with one formula expanded to its source

Notes

  • HTML and PDF exports output formulas and diagrams as they appear on screen. DOCX exports keep formulas as TeX source and convert diagrams to images.
  • The first time a diagram or formula is shown, it has to load, and “Loading the diagram engine…” or “Loading the formula engine…” appears briefly.

FOLORA