mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
put ID to generator
This commit is contained in:
parent
2aab93edb4
commit
e0a5ff07c2
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 {
|
||||
_, ok := node.AttributeString("id")
|
||||
id, ok := node.AttributeString("id")
|
||||
if !ok {
|
||||
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 {
|
||||
_, ok := node.AttributeString("id")
|
||||
id, ok := node.AttributeString("id")
|
||||
if !ok {
|
||||
generateAutoHeadingID(heading, reader, pc)
|
||||
} else {
|
||||
pc.IDs().Put(id.([]byte))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue