Skip to content

HTML Attributes without quote is broken #1141

@rhysd

Description

@rhysd

Marked version: 0.3.17

Markdown flavor: Markdown.pl|CommonMark|GitHub Flavored Markdown

Expectation

Marked can handle HTML attributes without quote like <a href=https://example.com></a> in markdown doc. It should be converted into <p><a href="https://example.com"></a></p>, the same as <a href="https://example.com"></a>.

Result

Converted into broken HTML <p>&lt;a href=<a href="https://example.com&gt;">https://example.com&gt;</a></a></p>

What was attempted

  1. npm install marked
  2. Put following code to foo.js
  3. Run node foo.js
const marked = require('marked');
console.log(marked('<a href=https://example.com></a>'));

Call stack & console log

<p>&lt;a href=<a href="https://example.com&gt;">https://example.com&gt;</a></a></p>

though I expected

<p><a href="https://example.com"></a></p>

Metadata

Metadata

Assignees

No one assigned

    Labels

    L1 - brokenValid usage causes incorrect output OR a crash AND there is no known workaround for the issuehelp wantedparser: CommonMark

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions