Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(minor) Notes without blank line at end of document aren't parsed #63

Open
Omikhleia opened this issue Feb 26, 2023 · 0 comments
Open

Comments

@Omikhleia
Copy link
Contributor

Omikhleia commented Feb 26, 2023

Found by @jslabovitz (via discussion)

If a (foot)note is the last element in a document, without blank line(s) after it, it fails to be parsed.

Test for reproducing

local lunamark = require("lunamark")
local opts = { notes = true }
local writer = lunamark.writer.html5.new(opts)
local parse = lunamark.reader.markdown.new(writer, opts)
local result, matadata = parse([[
Here is a note.[^mynote]

[^mynote]: This is supposed to be the note's footnote.
]])

print(result)

Observed result

<p>Here is a note.[^mynote]</p>

[^mynote]: This is supposed to be the note&#39;s footnote.

Expected result

<p>Here is a note.<sup><a href="#fn1" class="footnoteRef" id="fnref1">1</a></sup></p>

<hr />

<ol class="notes">
<li id="fn1"><p>This is supposed to be the note&#39;s footnote. <a href="#fnref1" class="footnoteBackLink">↩</a></p></li>
</ol>

Rationale

For comparison, Pandoc is happy parsing the note whether there's a blank line or not.

The workaround is easy (just adding a blank line), but it could be misleading to users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant