You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change adds a `title` property to the `Markdown` struct, which when
accessed is lazily evaluated to compute a plain text version of the first
top-level heading (H1) found in the Markdown text.
To make this happen, a `PlainTextConvertible` protocol is introduced,
which is also made a requirement of `Fragment`. A best effort is made
to convert each fragment into a reasonable plain text representation,
even if many of them will never be used as the implementation currently
stands (for example, lists can’t be placed inside headings). It still
felt worth it to do a proper implementation in case we ever make this
a public API for some reason.
This lets tools built on top of Ink extract a title for the parsed Markdown
document without doing additional string parsing.
0 commit comments