Runs the editor mode over a document, the way the editor does: one line at a time, carrying the state forward and calling blankLine for empty lines. Classes prefixed line- or line-background- belong to the line.
A line start outside a fenced code block and outside a script or style element of an HTML block is a resume point: the state after that line can be copied, and highlighting the rest of the document from that copy gives the same classes as highlighting the whole document. isLineStateResumable tells which states are.
| Function |
Description |
| copyLineState |
Copies a tokenizer state, so it can be kept as a resume point. |
| highlight |
Highlights a document. |
| highlightLines |
Highlights the lines of a document from a given line on, optionally resuming from a saved state. |
| isLineStateResumable |
Whether highlighting from a copy of a state gives what the parse that reached it gives from there on. A state inside a fenced code block, or inside a script or style element of an HTML block, is not. It holds a CodeMirror 5 mode made for that block when the block opened, and such a mode can keep state of its own between tokens, outside the state: the CSS mode keeps the last token’s type, and a - it reads no token from takes that type. A copy of the state shares the mode, so what the lines after it give depends on what that mode object tokenized last. A resume before the block makes the mode again when the block opens, as a parse from the start does. |