From e0a5ff07c251b1a6fa3aaf174acbdf7f5db58d68 Mon Sep 17 00:00:00 2001 From: Dmitry Sedykh Date: Sun, 22 Dec 2019 09:46:40 +0300 Subject: [PATCH] put ID to generator --- parser/atx_heading.go | 4 +++- parser/setext_headings.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/parser/atx_heading.go b/parser/atx_heading.go index c539427..0b63fab 100644 --- a/parser/atx_heading.go +++ b/parser/atx_heading.go @@ -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)) } } } diff --git a/parser/setext_headings.go b/parser/setext_headings.go index c98ea35..686efe1 100644 --- a/parser/setext_headings.go +++ b/parser/setext_headings.go @@ -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)) } } }