From 530d162cc5935370bdb70fa6b2f8395a87e87c2b Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 3 Oct 2023 02:20:39 -0400 Subject: [PATCH] Add support for display blocks and spans --- spec.txt | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/spec.txt b/spec.txt index bc55fc9f..2b7e2306 100644 --- a/spec.txt +++ b/spec.txt @@ -2355,7 +2355,82 @@ Closing code fences cannot have [info strings]: ```````````````````````````````` +## Fenced display blocks +A [display fence](@) is a sequence +of at least two consecutive dollar sign characters (`$`) +A [fenced display block](@) begins with a display fence, +preceded by up to three spaces of indentation. + +Fenced display blocks follow the same rules as [Fenced code blocks] +regarding the [info string], positioning, and content processing. + +Display blocks are intended to house code that is intended to be rendered +rather than literally displayed. The [info string] can be used to specify +the render engine. Example use cases are rendering TeX via MathML, +a diagraming tool such as Marmaid or graphviz via a library, or a vector +graphics tool. + +If no info string is specified, the display block should be processed as +TeX and presented as MathML. + +If a rendering tool is not supported, the plain text should be presented +exactly as an equivalent [Fenced code block]. If rendering fails, the +engine may elect whether to present an error or fall back to rendering as +a code block. + +Here is a simple example of TeX to MathML: + +```````````````````````````````` example +$$ +ax^2 + bx + c +$$ +. + + + a + + x + 2 + + + + b + x + + + c + + +```````````````````````````````` + +The language `tex` may optionally be specified: + +```````````````````````````````` example +$$tex +\frac{a}{b} +$$ +. + + + a + b + + +```````````````````````````````` + +More than two `$` characters may be used + +```````````````````````````````` example +$$$$$ +\frac{a}{b} +$$$$$ +. + + + a + b + + +```````````````````````````````` ## HTML blocks @@ -6094,6 +6169,37 @@ closing backtick strings to be equal in length:

`foobar

```````````````````````````````` +## Display Spans + +A [dollar string](@) is a string of one or more dollar characters (`$`). + +A [display span](@) begins with a dollar string and ends with a dollar +string of equal length. The contents of a display span should be +preprocessed in an identical way as [Code spans]. + +Display spans are meant to contain code that can directly be rendered. +The renderer should by default treat display span contents as TeX, and +render it as MathML. If the renderer does not support MathML, it should +render display spans identical to code spans. + +This is a simple code span: + +```````````````````````````````` example +$x = \frac{a}{b}$ +. + + + x + = + + + + a + b + + + +```````````````````````````````` ## Emphasis and strong emphasis