Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/markdownit/mathematics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const escapeHtml = (unsafe: string) =>
.replace(/'/g, ''')

const renderBlock = (content: string) =>
`<div data-type="block-math" data-latex="${escapeHtml(content)}" />`
`<div data-type="block-math" data-latex="${escapeHtml(content)}"></div>`

const renderInline = (content: string) =>
`<span data-type="inline-math" data-latex="${escapeHtml(content)}">${escapeHtml(content)}</span>`
Expand Down
6 changes: 6 additions & 0 deletions src/tests/markdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ describe('Markdown serializer from html', () => {
'<details>\n<summary>**summary**</summary>\n```\ncode\n```\n\n</details>\n',
)
})

test('math (content following math stays, #8654)', () => {
const test =
'Content above\n\n$$\n\\sum_{i=1}^n i = \\frac{n(n+1)}{2}\n$$\n\nContent below'
expect(markdownThroughEditor(test)).toBe(test)
})
})

describe('Trailing nodes', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/markdownit/mathematics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $$
expect(stripIndent(rendered)).toBe(
stripIndent(`
<p>Here is some more math:</p>
<div data-type="block-math" data-latex="1 + 1 + 1 = 3" />
<div data-type="block-math" data-latex="1 + 1 + 1 = 3"></div>
<p>.</p>`),
)
})
Expand Down
Loading