MCPcopy
hub / github.com/russross/blackfriday / helperEmphasis

Function helperEmphasis

inline.go:1112–1150  ·  view source on GitHub ↗
(p *Markdown, data []byte, c byte)

Source from the content-addressed store, hash-verified

1110}
1111
1112func helperEmphasis(p *Markdown, data []byte, c byte) (int, *Node) {
1113 i := 0
1114
1115 // skip one symbol if coming from emph3
1116 if len(data) > 1 && data[0] == c && data[1] == c {
1117 i = 1
1118 }
1119
1120 for i < len(data) {
1121 length := helperFindEmphChar(data[i:], c)
1122 if length == 0 {
1123 return 0, nil
1124 }
1125 i += length
1126 if i >= len(data) {
1127 return 0, nil
1128 }
1129
1130 if i+1 < len(data) && data[i+1] == c {
1131 i++
1132 continue
1133 }
1134
1135 if data[i] == c && !isspace(data[i-1]) {
1136
1137 if p.extensions&NoIntraEmphasis != 0 {
1138 if !(i+1 == len(data) || isspace(data[i+1]) || ispunct(data[i+1])) {
1139 continue
1140 }
1141 }
1142
1143 emph := NewNode(Emph)
1144 p.inline(emph, data[:i])
1145 return i + 1, emph
1146 }
1147 }
1148
1149 return 0, nil
1150}
1151
1152func helperDoubleEmphasis(p *Markdown, data []byte, c byte) (int, *Node) {
1153 i := 0

Callers 2

emphasisFunction · 0.85
helperTripleEmphasisFunction · 0.85

Calls 5

helperFindEmphCharFunction · 0.85
isspaceFunction · 0.85
ispunctFunction · 0.85
NewNodeFunction · 0.85
inlineMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…