(p *Markdown, data []byte, c byte)
| 1110 | } |
| 1111 | |
| 1112 | func 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 | |
| 1152 | func helperDoubleEmphasis(p *Markdown, data []byte, c byte) (int, *Node) { |
| 1153 | i := 0 |
no test coverage detected
searching dependent graphs…