Inline Sources #
The block parser carves a paragraph or heading into a sequence of source lines with the prefixes of
enclosing containers already removed. The inline parser then reads that content as if it were a
single contiguous string, while still producing subslices of s. InlineSource bundles the
per-line subslices. Its constructor is private to prevent missing or double normalization.
ofLines normalizes a block's lines as CommonMark §4.8 requires, and it is the only way to build an
InlineSource.
The lines of a paragraph or setext heading, each as a subslice of the source. These lines form the input to the inline parser.
Container prefixes such as > and leading spaces and tabs are not included in the lines. Each line
except the last line of the block ends with its line ending, so the inline parser sees a line ending
at each line boundary. The last line does not include its trailing whitespace.
The lines are in source order and do not overlap.
The lines, in source order.
There is at least one line.
Instances For
The first source position of src.
Instances For
One past the last source position of src.
Equations
- src.stopPos = (src.lines.back ⋯).endExclusive
Instances For
The index of the first line that ends after p, which is the line that contains p when some line
does. This is src.lines.size when every line ends at or before p.
Equations
- src.lineIndex p = Lean.Markdown.InlineSource.lineIndex.go✝ src p 0 src.lines.size ⋯
Instances For
The part of each line that is within [p1, p2). A line whose part is empty is included when
[p1, p2) reaches it, so there is one part per source line that the content spans. If p1 is past
every line, the result is the single subslice from p1 to p2.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Constructs an InlineSource from the source lines of a paragraph. This implements the
CommonMark §4.8 paragraph content normalization:
- Leading spaces and tabs are removed from each line.
- Each line except the last ends with the line ending that follows it in the source.
- Trailing whitespace is removed from the last line.
Equations
- One or more equations did not get rendered due to their size.