pulldown-cmark: Footnote definition does not end

extern crate pulldown_cmark as cmark;

use cmark::{Options, Parser};

fn main() {
    for e in Parser::new_ext("Hello, [^goo]\n\n\
                              [^goo]: world.\n\n\
                              Follow [link][ref]",
                             Options::all()) {
        println!("{:?}", e);
    }
}

The above code outputs (footnote definition extending until the end):

Start(Paragraph)
Text("Hello, ")
FootnoteReference("goo")
End(Paragraph)
Start(FootnoteDefinition("goo"))
Start(Paragraph)
Text("world.")
End(Paragraph)
Start(Paragraph)
Text("Follow ")
Text("[link]")
Text("[ref]")
End(Paragraph)
End(FootnoteDefinition("goo"))

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Note for folks following this thread: I am (albeit very slowly) working my way toward a solution to alllll the footnote issues over on #544. Honestly, it’ll likely be the end of the year before I have something working (at earliest!) but I really, really want “standard” footnotes to just work in pulldown-cmark, so I’m going to keep pushing on it, however slowly.

@ScottAbbey You’re right, that’s indeed an inconsistency. I’ll update the proposal soon.

UPDATE: Updated

I sent a PR to take a look at. One question I have is, how should the following be handled:

a: [^b]

[^b]: * a
* b

* c

d

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.