Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFootnote definition does not end #20
Comments
raphlinus
referenced this issue
Apr 10, 2016
Merged
End footnote definition with one blank line. #21
This comment has been minimized.
This comment has been minimized.
|
I sent a PR to take a look at. One question I have is, how should the following be handled:
Here we have a conflict between two rules: the footnote should be closed by one blank line, but the list (which is inside the footnote) is closed by two. With the code in the PR, the list [a, b] is inside the footnote def, while c gets its own list. This seems reasonable but I want to think about whether it's truly the best behavior. Alternatively (since the spec doesn't nail this down), we can dictate that footnotes and lists are both consistently ended by two blank lines. |
This comment has been minimized.
This comment has been minimized.
|
I (personally) don't see this as a bug. If you look in |
This comment has been minimized.
This comment has been minimized.
I see... I did not "expect" that (or lists) in footnotes. Generally, footnotes are a single paragraph of text.
If we are going to take the route of making footnotes end with a single blank line (which is probably what most people might expect, and markdown is about being intuitive, right?), then deny lists inside it (for consistency in number of blank lines). I'm against it because it will look kinda ugly if footnote definitions (containing lists) are rendered as a numeric list (as in wikipedia). |
This comment has been minimized.
This comment has been minimized.
Spec for multi-block footnote-definitions.
UPDATE (2017-03-30): Simplify |
This comment has been minimized.
This comment has been minimized.
chriskrycho
commented
May 2, 2016
|
FWIW, the reason the spec acts the way it does is because, whatever is most common in writing contexts, multi-paragraph footnotes are a genuine need. (I have from time to time used them myself.) Just as importantly in many ways, pretty much all existing implementations with footnote support treat footnotes as a(n indented) block type, which allows them to have multiple paragraphs within them. So whatever is most purely "intuitive" may not be what's best in this case. |
This comment has been minimized.
This comment has been minimized.
|
Regarding the list within footnote issue above:
This appears to have changed between CommonMark 0.26 and 0.27. 0.26:
0.27:
So it is clear that the |
This comment has been minimized.
This comment has been minimized.
|
Follow-up from #21 (comment): It looks like this footnote spec is homegrown rather than part of the CommonMark spec. How open is it for change? I would not have expected list item It appears as though a footnote definition should treated as a container block -- all indications in this thread are that footnotes are expected to support multiple paragraphs, lists, and other blocks. If a footnote definition is a container block, it should act very much like list items do in CommonMark. Continuing lines in a footnote definition should be indented to the same level as the first non-whitespace character after the Is there an argument against treating footnotes as an additional type of container block similar to a list item? |
This comment has been minimized.
This comment has been minimized.
|
The following text:
Generates:
Instead of:
Which can be generated if there is a blank line between footnote definitions. Is this intentional too? |
This comment has been minimized.
This comment has been minimized.
It appears to be intentional as that is covered specifically by a test case in the footnotes.txt spec. I would have expected your example to be two separate footnote definitions if I hadn't read that spec first. Was this footnote spec copied from somewhere or just made for this program? |
This comment has been minimized.
This comment has been minimized.
|
I just made it up. |
This comment has been minimized.
This comment has been minimized.
|
After going through the spec for lists once again, and keeping the goal to maximize intuitiveness, I rewrote the spec I proposed earlier (in-place). Please take a look. I tried to make it consistent with the current style of specs. |
This comment has been minimized.
This comment has been minimized.
|
This example:
With the footnote identifier change to a list item marker would be all one list item due to lazy continuation rules. The "outside footnote" text would be part of the "list item inside footnote" (see here) Considering your second example as a list item rather than a footnote, it seems fine. However, this version should probably all be one footnote due to laziness:
This version with the subsequent line indented to one space beyond the footnote marker should probably be just like a list item starting with a blank line:
I agree with your third example. It seems like the one place this still differs from list items is dealing with a long footnote name. Subsequent blocks inside a list item (except in the case of laziness) need to be indented as far as the first non-whitespace character after the list marker. If the footnote name is very long, this could be impractical. I think the discussion starting with "Would it help to adopt a two-space rule?" under 5.2.1 Motivation in the CommonMark spec may be relevant here. Perhaps a two-space rule can be justified by something like "The |
This comment has been minimized.
This comment has been minimized.
|
@ScottAbbey You're right, that's indeed an inconsistency. I'll update the proposal soon. UPDATE: Updated |
This comment has been minimized.
This comment has been minimized.
|
What's the status on this? I just ran into this problem with the following reference-list: [^foo]: foo
[bar]: barThis generates the following events, which make the parser not being able to find the link definition and instead calls the broken_link_callback: Start(FootnoteDefinition("foo")),
Start(Paragraph),
Text("foo"),
SoftBreak,
Text("[bar]: bar"),
End(Paragraph),
End(FootnoteDefinition("foo")) |
critiqjo commentedApr 10, 2016
The above code outputs (footnote definition extending until the end):