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

Function helperTripleEmphasis

inline.go:1176–1218  ·  view source on GitHub ↗
(p *Markdown, data []byte, offset int, c byte)

Source from the content-addressed store, hash-verified

1174}
1175
1176func helperTripleEmphasis(p *Markdown, data []byte, offset int, c byte) (int, *Node) {
1177 i := 0
1178 origData := data
1179 data = data[offset:]
1180
1181 for i < len(data) {
1182 length := helperFindEmphChar(data[i:], c)
1183 if length == 0 {
1184 return 0, nil
1185 }
1186 i += length
1187
1188 // skip whitespace preceded symbols
1189 if data[i] != c || isspace(data[i-1]) {
1190 continue
1191 }
1192
1193 switch {
1194 case i+2 < len(data) && data[i+1] == c && data[i+2] == c:
1195 // triple symbol found
1196 strong := NewNode(Strong)
1197 em := NewNode(Emph)
1198 strong.AppendChild(em)
1199 p.inline(em, data[:i])
1200 return i + 3, strong
1201 case (i+1 < len(data) && data[i+1] == c):
1202 // double symbol found, hand over to emph1
1203 length, node := helperEmphasis(p, origData[offset-2:], c)
1204 if length == 0 {
1205 return 0, nil
1206 }
1207 return length - 2, node
1208 default:
1209 // single symbol found, hand over to emph2
1210 length, node := helperDoubleEmphasis(p, origData[offset-1:], c)
1211 if length == 0 {
1212 return 0, nil
1213 }
1214 return length - 1, node
1215 }
1216 }
1217 return 0, nil
1218}
1219
1220func text(s []byte) *Node {
1221 node := NewNode(Text)

Callers 1

emphasisFunction · 0.85

Calls 7

AppendChildMethod · 0.95
helperFindEmphCharFunction · 0.85
isspaceFunction · 0.85
NewNodeFunction · 0.85
helperEmphasisFunction · 0.85
helperDoubleEmphasisFunction · 0.85
inlineMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…