mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Add clarifying comments for thematic break parser
This commit is contained in:
parent
686e68d8bd
commit
0f77f829e4
1 changed files with 8 additions and 0 deletions
|
|
@ -17,6 +17,10 @@ func NewThematicBreakParser() BlockParser {
|
||||||
return defaultthematicBreakParser
|
return defaultthematicBreakParser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isThematicBreak returns true if a line indented
|
||||||
|
// with an offset contains only a set of three or more
|
||||||
|
// asterisks, dashes, or underscores mixed with characters
|
||||||
|
// deemed white space by [util.IsSpace].
|
||||||
func isThematicBreak(line []byte, offset int) bool {
|
func isThematicBreak(line []byte, offset int) bool {
|
||||||
w, pos := util.IndentWidth(line, offset)
|
w, pos := util.IndentWidth(line, offset)
|
||||||
if w > 3 {
|
if w > 3 {
|
||||||
|
|
@ -30,14 +34,18 @@ func isThematicBreak(line []byte, offset int) bool {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if mark == 0 {
|
if mark == 0 {
|
||||||
|
// note the mark character
|
||||||
mark = c
|
mark = c
|
||||||
count = 1
|
count = 1
|
||||||
if mark == '*' || mark == '-' || mark == '_' {
|
if mark == '*' || mark == '-' || mark == '_' {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// mark character was not recognized
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if c != mark {
|
if c != mark {
|
||||||
|
// current character does not match
|
||||||
|
// previously noted mark
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
count++
|
count++
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue