Ignore footnotes ids when handlings content sections #126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Footnotes produce a reference that can be linked to and will show up in
the
ids
part of a page's Ast (see #92).Footnotes have no directive attached to them, as their referenced
sections are added implicitly when they are processed by the parser.
The
contentSection
related methods did assume that all nodes inids
are proper sections, so having footnotes would break layouts that use
such an API, e.g.
$page.contentSections()
.This commit updates those implementations to expect nodes to not
necessarily have a directive.
Additionally, the logic of
hasContentSection
is aligned with thebehavior of
contentSection(id)
, so that returning a true value willnot trigger an error when getting the content section.
This would have been possible before id the node with that name is not a
section
, however it might have been that, in practice, this was neverthe case.
I added a footnote to the sections snapshot to show that rendering this
page does no longer break.
I also considered a change in supermd that would not include footnotes
in the
ids
list, but that would have lost the ability to #ref-linkto footnotes outside of the footnote rendering itself.