Add support for EXCLUDE_TAGS and :noexport:
This commit is contained in:
parent
c3d635eacb
commit
beff0c0d8a
7 changed files with 24 additions and 1 deletions
|
@ -16,6 +16,7 @@ type HTMLWriter struct {
|
|||
HighlightCodeBlock func(source, lang string) string
|
||||
FootnotesHeadingTitle string
|
||||
htmlEscape bool
|
||||
excludeTags []string
|
||||
log *log.Logger
|
||||
}
|
||||
|
||||
|
@ -65,6 +66,7 @@ func (w *HTMLWriter) nodesAsString(nodes ...Node) string {
|
|||
}
|
||||
|
||||
func (w *HTMLWriter) before(d *Document) {
|
||||
w.excludeTags = strings.Fields(d.Get("EXCLUDE_TAGS"))
|
||||
w.log = d.Log
|
||||
}
|
||||
|
||||
|
@ -207,6 +209,13 @@ func (w *HTMLWriter) writeHeadline(h Headline) {
|
|||
if h.Lvl == 1 && title == w.FootnotesHeadingTitle {
|
||||
return
|
||||
}
|
||||
for _, excludeTag := range w.excludeTags {
|
||||
for _, tag := range h.Tags {
|
||||
if excludeTag == tag {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if id, ok := h.Properties.Get("CUSTOM_ID"); ok {
|
||||
w.WriteString(fmt.Sprintf(`<h%d id="%s">`, h.Lvl, id) + "\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue