Skip to content

Earmark GFM Footnote Return to Article Link Text Rendered Incorrectly #1452

Closed
RobertDober/earmark_parser
#163
@jwilger

Description

@jwilger

When parsing a markdown document that contains footnotes with the option footnotes: true passed to Earmark, the link that is inserted at the end of the footnote by Earmark has the link text set to ["↩"] (https://github.com/RobertDober/earmark_parser/blob/5797a53a1d60003e5d0038c326bfd1e8b129c85f/lib/earmark_parser/ast/renderer/footnote_renderer.ex#L31).

When rendering the documentation as HTML via ex_doc, this link text is escaped, replacing the & with &, so that the literal ↩ is displayed in the text rather than the HTML entity that was intended.

It looks like ex_doc can take a verbatim: true option when rendering a tag (

def to_string({tag, attrs, inner, %{verbatim: true}} = ast, fun) do
) which seems like it would address this issue, but I'm not entirely sure how to get ex_doc to use that option in this case. Part of me wonders if that option shouldn't just be used for all text that is coming from the markdown processor, thus making any escaping of HTML entities the job of the markdown processor itself rather than the templating modules of ex_doc, but I'm not familiar enough with the ins and outs of the project to know if that would be a good idea or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions