Skip to content

Commit a2af119

Browse files
committed
refactor(math): remove commented-out strong matching logic
1 parent 570c816 commit a2af119

File tree

1 file changed

+0
-26
lines changed
  • packages/markdown-parser/src/plugins

1 file changed

+0
-26
lines changed

packages/markdown-parser/src/plugins/math.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,6 @@ export function applyMath(md: MarkdownIt, mathOpts?: MathOptions) {
193193

194194
if (!text)
195195
return
196-
// const strongMatch = text.match(/^(\*+)([^*]+)(\**)/)
197-
// if (strongMatch) {
198-
// const strongToken = state.push('strong_open', '', 0)
199-
// strongToken.markup = strongMatch[1]
200-
// const strongTextToken = state.push('text', '', 0)
201-
// // guard against unexpected undefined values
202-
// strongTextToken.content = strongMatch[2] == null ? '' : String(strongMatch[2])
203-
// const strongCloseToken = state.push('strong_close', '', 0)
204-
// strongCloseToken.markup = strongMatch[1]
205-
// if (!strongMatch[3])
206-
// return
207-
// text = text.slice(strongMatch[0].length)
208-
// if (text) {
209-
// const t = state.push('text', '', 0)
210-
// t.content = text
211-
// }
212-
// state.pos = state.src.length
213-
// searchPos = state.pos
214-
// return
215-
// }
216196

217197
const t = s.push('text', '', 0)
218198
t.content = text
@@ -304,12 +284,6 @@ export function applyMath(md: MarkdownIt, mathOpts?: MathOptions) {
304284
// If we already consumed some content, avoid duplicating the prefix
305285
// Only push the portion from previous search position
306286
const prevConsumed = src.slice(0, searchPos)
307-
// Determine whether there's an unclosed strong opener (**) or (__)
308-
// before this math delimiter. We only want to treat a prefix as a
309-
// strong-open when the number of unescaped strong markers in the
310-
// preceding segment is odd (i.e. there's an unmatched opener). This
311-
// avoids treating a fully paired `**bold**` as an open prefix.
312-
313287
let toPushBefore = prevConsumed ? src.slice(preMathPos, index) : before
314288
const isStrongPrefix = countUnescapedStrong(toPushBefore) % 2 === 1
315289
if (index !== s.pos && isStrongPrefix) {

0 commit comments

Comments
 (0)