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
write_md carries a bunch of state, including heap-allocated state, which it needs for handling references.
In link_transform::inlines_to_string (introduced in #86), we have a &Vec<Inline> that we need to write as markdown, but it cannot contain links (per the GFM spec) and thus doesn't need all that state. 1
We could be more efficient by factoring the inlines-writing to an InlineMdWriter<L: LinkWriter>, where LinkWriter is a new trait. In the general write_md case, that trait would hold all the ref-handling state that MdWriterState holds today, but in the link_transform::inlines_to_string, we would just ignore link definitions altogether (since we don't expect to see links).
Footnotes
I'm pretty sure it can't contain footnotes, either. If you try, the footnote does appear (which it doesn't if you have the [^a]: blah definition but no reference to it), but the link breaks and does not contain a reference down to that footnote). Anyway, it's a weird case. ↩
The text was updated successfully, but these errors were encountered:
(note: the footnote itself will be all the way down at the bottom)
Note:
the hello [^a] world text shows up just as hello [^a], with world not part of the link
the footnote shows up as [1], not [1] as expected
clicking on the link or the footnote definition does work
This suggests that an inline writer would still need to keep track of the footnotes, or at least append them to a &mut that eventually pipes to something equivalent to today's MdWriterState::seen_footnotes.
write_md
carries a bunch of state, including heap-allocated state, which it needs for handling references.In
link_transform::inlines_to_string
(introduced in #86), we have a&Vec<Inline>
that we need to write as markdown, but it cannot contain links (per the GFM spec) and thus doesn't need all that state. 1We could be more efficient by factoring the inlines-writing to an
InlineMdWriter<L: LinkWriter>
, whereLinkWriter
is a new trait. In the generalwrite_md
case, that trait would hold all the ref-handling state thatMdWriterState
holds today, but in thelink_transform::inlines_to_string
, we would just ignore link definitions altogether (since we don't expect to see links).Footnotes
I'm pretty sure it can't contain footnotes, either. If you try, the footnote does appear (which it doesn't if you have the
[^a]: blah
definition but no reference to it), but the link breaks and does not contain a reference down to that footnote). Anyway, it's a weird case. ↩The text was updated successfully, but these errors were encountered: