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

Footnote not processed if there is a whitespace in text #216

Closed
nsarang opened this issue Jun 4, 2024 · 2 comments
Closed

Footnote not processed if there is a whitespace in text #216

nsarang opened this issue Jun 4, 2024 · 2 comments
Labels

Comments

@nsarang
Copy link

nsarang commented Jun 4, 2024

Hi folks,
I've encountered an issue where footnote tokens aren't properly tagged if there is any white space in the text.

Example

from mistletoe import block_token

lines = '''
[^1]: Works
[^2]: Not working
'''
token = block_token.Document(lines)
print(token.footnotes)

outputs:

{'^1': ('Works', '')}

While removing the space produces:

{'^1': ('Works', ''), '^2': ('Notworking', '')}
@pbodnar
Copy link
Collaborator

pbodnar commented Jun 4, 2024

@nsarang, thanks for the report. The actual problem is that mistletoe doesn't support footnotes in the form as for example GitHub here does -> see #47 for the feature request.

Instead, mistletoe only supports so called link reference definitions as described in the CommonMark Spec: https://spec.commonmark.org/0.30/#link-reference-definitions. That's why [^2]: Not working is treated as a plain text - because it matches the case from spec's Example 209. Historically, mistletoe uses term "footnotes" for these, which I admit might be confusing...

@pbodnar pbodnar closed this as completed Jun 4, 2024
@nsarang
Copy link
Author

nsarang commented Jun 6, 2024

Thanks for the clarification @pbodnar

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

No branches or pull requests

2 participants