Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 75a0efe

Browse files
author
Matthew Williams
committed
Add comments describing purpose of isBoldAndItalic
1 parent 5d9add3 commit 75a0efe

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

claat/parser/md/html.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func isItalic(hn *html.Node) bool {
6161
hn.DataAtom == atom.I
6262
}
6363

64+
// This is different to calling isBold and isItalic seperately as we must look
65+
// up an extra level in the tree
6466
func isBoldAndItalic(hn *html.Node) bool {
6567
if hn.Parent == nil || hn.Parent.Parent == nil {
6668
return false

claat/parser/md/parse.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ func link(ds *docState) types.Node {
849849
func text(ds *docState) types.Node {
850850
bold := isBold(ds.cur)
851851
italic := isItalic(ds.cur)
852+
// We must call this to look up an extra level in the node tree to obtain both styles
852853
if isBoldAndItalic(ds.cur) {
853854
bold = true
854855
italic = true

0 commit comments

Comments
 (0)