mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Fixes #223
This commit is contained in:
parent
38f7fc92ff
commit
040b478cdb
2 changed files with 13 additions and 1 deletions
|
|
@ -68,3 +68,11 @@
|
|||
//- - - - - - - - -//
|
||||
<h1 id="test--class0">Test ## {class=0#.}</h1>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
||||
|
||||
7: short handed ids can contain hyphens ("-"), underscores ("_"), colons (":"), and periods (".")
|
||||
//- - - - - - - - -//
|
||||
# Test ## {#id-foo_bar:baz.qux .foobar}
|
||||
//- - - - - - - - -//
|
||||
<h1 id="id-foo_bar:baz.qux" class="foobar">Test</h1>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
|
|
|||
|
|
@ -89,7 +89,11 @@ func parseAttribute(reader text.Reader) (Attribute, bool) {
|
|||
reader.Advance(1)
|
||||
line, _ := reader.PeekLine()
|
||||
i := 0
|
||||
for ; i < len(line) && !util.IsSpace(line[i]) && (!util.IsPunct(line[i]) || line[i] == '_' || line[i] == '-'); i++ {
|
||||
// HTML5 allows any kind of characters as id, but XHTML restricts characters for id.
|
||||
// CommonMark is basically defined for XHTML(even though it is legacy).
|
||||
// So we restrict id characters.
|
||||
for ; i < len(line) && !util.IsSpace(line[i]) &&
|
||||
(!util.IsPunct(line[i]) || line[i] == '_' || line[i] == '-' || line[i] == ':' || line[i] == '.'); i++ {
|
||||
}
|
||||
name := attrNameClass
|
||||
if c == '#' {
|
||||
|
|
|
|||
Loading…
Reference in a new issue