Skip to content

Commit

Permalink
Merge pull request #92 from neonichu/support-data-attributes-in-inlin…
Browse files Browse the repository at this point in the history
…e-html

Add `-` to allowed characters for inline HTML
  • Loading branch information
mdiep committed Dec 25, 2015
2 parents 8783902 + 3a4a31c commit 82647ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/MMHTMLParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ - (MMElement *)_parseLenientBlockTagWithScanner:(MMScanner *)scanner
- (NSRange)_parseNameWithScanner:(MMScanner *)scanner
{
NSMutableCharacterSet *nameSet = [NSMutableCharacterSet alphanumericCharacterSet];
[nameSet addCharactersInString:@":"];
[nameSet addCharactersInString:@":-"];

NSRange result = NSMakeRange(scanner.location, 0);
result.length = [scanner skipCharactersFromSet:nameSet];
Expand Down
7 changes: 7 additions & 0 deletions Tests/MMHTMLTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ - (void)testUnclosedAngleBracket
MMAssertMarkdownEqualsHTML(@"<1", @"<p>&lt;1</p>");
}

- (void)testInlineHTMLWithDataAttributes
{
NSString* html = @"<a href=\"https://example.com/foo.js\" data-card-width=\"100%\">foo</a>";
NSString* htmlWithParagraph = [NSString stringWithFormat:@"<p>%@</p>", html];
MMAssertMarkdownEqualsHTML(html, htmlWithParagraph);
}


#pragma mark - HTML Comment Tests

Expand Down

0 comments on commit 82647ca

Please sign in to comment.