Documentation
¶
Overview ¶
Package mdspan finds the inline spans of a markdown line that are not running prose: code spans and links.
It lives here because two readers need the same answer and neither may import the other: the extractor masks code spans so an example in code is not a directive, and the sentence binder must not end a sentence at a full stop inside a code span or a link's text. A second copy of the backtick rule is how the two would drift.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Link ¶ added in v0.1.3
Link is one inline link or image, `[text](destination)`, as byte ranges of its line. Dest excludes the angle brackets of a `<…>` destination.
func InlineLinks ¶ added in v0.1.3
InlineLinks returns every inline link or image in line, in order.
The destination follows CommonMark: either `<…>`, which may hold spaces, or a run with no whitespace in which parentheses must balance, so `count(*)` stays inside the destination rather than ending it. Every reader of directive links -- the extractor, render, the sentence binder -- uses this one function. They each had a regular expression that stopped at the first `)` or space, so a query holding `count(*)` was cut short and one holding a space was not a link at all, and the directive vanished without a word (bug 51).
type Span ¶
type Span struct{ Start, End int }
Span is a half-open byte range [Start, End) of a line.