Skip to content

Reference links don't work if the link label contains backticks #495

Open
@mDuo13

Description

@mDuo13

Reference Links with Formatting Test

An inline link can contain various Markdown formatting.

A reference link works when you don't have any formatting.

A reference link with formatting also renders properly.

If that formatting contains code backticks then it should, but the Python renderer doesn't handle it correctly.

Source:

# Reference Links with Formatting Test

An [_inline_ link **can** contain various `Markdown` formatting.](https://github.com/)

A reference link [works when you don't have any formatting][].

[works when you don't have any formatting]: https://example.com/

A [reference link _with_ formatting][] also renders properly.

[reference link _with_ formatting]: https://example.com/ref-link-with-formatting

If that [formatting contains `code` backticks][] then it should, but the Python renderer doesn't handle it correctly.

[formatting contains `code` backticks]: https://example.com/ref-link-with-code

Output of python -m markdown with Markdown 2.6.2 module (verified with Python 2.7.12 and Python 3.5.2 both on Linux):

<h1>Reference Links with Formatting Test</h1>
<p>An <a href="/"><em>inline</em> link <strong>can</strong> contain various <code>Markdown</code> formatting.</a></p>
<p>A reference link <a href="https://example.com/">works when you don't have any formatting</a>.</p>
<p>A <a href="https://example.com/ref-link-with-formatting">reference link <em>with</em> formatting</a> also renders properly?</p>
<p>If that [formatting contains <code>code</code> backticks][] then it doesn't?</p>[mduo13@Manatsu ~]$ cat md_reflink_test.md | python -m markdown
<h1>Reference Links with Formatting Test</h1>
<p>An <a href="/"><em>inline</em> link <strong>can</strong> contain various <code>Markdown</code> formatting.</a></p>
<p>A reference link <a href="https://example.com/">works when you don't have any formatting</a>.</p>
<p>A <a href="https://example.com/ref-link-with-formatting">reference link <em>with</em> formatting</a> also renders properly.</p>
<p>If that [formatting contains <code>code</code> backticks][] then it should, but the Python renderer doesn't handle it correctly.</p>

As you can see, in the Python output, it retains the [brackets around link label][] in the output HTML.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.coreRelated to the core parser code.someday-maybeApproved low priority request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions