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

Support HTML attributes without quotes (Fix #1141) #1142

Closed
wants to merge 2 commits into from

Conversation

rhysd
Copy link

@rhysd rhysd commented Mar 14, 2018

Marked version: 0.3.17

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

Description

I modified a regex to match HTML tags to

^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:="[^"]*"|='[^']*'|=[^<>\s]+|\s[^<=>\/\s]*)*?\/?>

For example, when matching to <a href=https://example.com>,

  • \s[^<=>\/\s]* matches to attribute name just before =: href
  • =[^<>\s]+ matches to = and attribute value without quotes: =https://example.com
  • Regex in (?:...) matches only strings starting with = or \s. So finally it breaks and matches to the last >

Contributor

  • Test(s) exist to ensure functionality and minimize regresstion (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@UziTech
Copy link
Member

UziTech commented Mar 14, 2018

@Feder1co5oave does #1135 address this?

@Feder1co5oave
Copy link
Contributor

Yes

@joshbruce
Copy link
Member

Closing in favor of #1135

@joshbruce joshbruce closed this Mar 22, 2018
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

Successfully merging this pull request may close these issues.

HTML Attributes without quote is broken
4 participants