mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
commit
efd5960110
2 changed files with 6 additions and 2 deletions
|
|
@ -171,9 +171,11 @@ func (b *atxHeadingParser) Close(node ast.Node, reader text.Reader, pc Context)
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.AutoHeadingID {
|
if b.AutoHeadingID {
|
||||||
_, ok := node.AttributeString("id")
|
id, ok := node.AttributeString("id")
|
||||||
if !ok {
|
if !ok {
|
||||||
generateAutoHeadingID(node.(*ast.Heading), reader, pc)
|
generateAutoHeadingID(node.(*ast.Heading), reader, pc)
|
||||||
|
} else {
|
||||||
|
pc.IDs().Put(id.([]byte))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,9 +108,11 @@ func (b *setextHeadingParser) Close(node ast.Node, reader text.Reader, pc Contex
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.AutoHeadingID {
|
if b.AutoHeadingID {
|
||||||
_, ok := node.AttributeString("id")
|
id, ok := node.AttributeString("id")
|
||||||
if !ok {
|
if !ok {
|
||||||
generateAutoHeadingID(heading, reader, pc)
|
generateAutoHeadingID(heading, reader, pc)
|
||||||
|
} else {
|
||||||
|
pc.IDs().Put(id.([]byte))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue