fix(web): keep a lone dollar on a later line inside the block
This commit is contained in:
1 parent
6a2692c06b
commit
eeaac47630
2 files changed
+10
-2
No files matched your search
@@ -236,8 +236,10 @@ function createMathFlow(marker: number, openMarker: number, closeMarker: number)
|
||||
// that line's ending while a later `$$` on the same line still closes; on
|
||||
// any later line it ends the candidate outright, so a following block is
|
||||
// not swallowed. A solitary `$` is content, not a failed fence.
|
||||
if (crossedLineEnding) return nok(code)
|
||||
if (sawClosingFenceSequence) failedClose = true
|
||||
if (sawClosingFenceSequence) {
|
||||
if (crossedLineEnding) return nok(code)
|
||||
failedClose = true
|
||||
}
|
||||
return markerValueStart(code)
|
||||
}
|
||||
|
||||
|
||||
@@ -656,6 +656,12 @@ describe('MarkdownText', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps a lone dollar on a later line inside the block', () => {
|
||||
const { container } = render(<MarkdownText text={'$$a+b\nc$d\n$$'} />)
|
||||
|
||||
expect(container.querySelector('.katex-error')?.textContent).toBe('a+b\nc$d')
|
||||
})
|
||||
|
||||
it('keeps a fence that fails inside a comment and a trailing lone dollar parseable', () => {
|
||||
const commentFail = render(<MarkdownText text={'$$x%$$ y'} />)
|
||||
expect(commentFail.container.querySelector('.katex-display')).toBeNull()
|
||||
|
||||
Reference in new issue
Block a user