fix: render task notes with standard markdown
This commit is contained in:
@@ -86,16 +86,20 @@ describe('task utilities', () => {
|
||||
expect(buildTaskRecurrencePayload('none', { afterCompletionDays: '1' })).toEqual({})
|
||||
})
|
||||
|
||||
it('renders safe practical markdown and strips unsafe html', () => {
|
||||
const html = renderMarkdown('# Plan\n> Note\n1. first\n- [x] done\n\n```js\nconst x = 1\n```\n**bold** [link](https://example.com)\n<script>alert(1)</script>')
|
||||
it('renders safe standard markdown with paragraphs, nesting, tasks, and fenced code', () => {
|
||||
const html = renderMarkdown('# Plan\n\nFirst line\nsecond line\n\n- parent\n - child\n\n- [x] done\n\n```js\nconst x = 1\n```\n\n**bold** [link](https://example.com)\n<script>alert(1)</script>')
|
||||
expect(html).toContain('<h1>Plan</h1>')
|
||||
expect(html).toContain('<blockquote>Note</blockquote>')
|
||||
expect(html).toContain('<ol><li>first</li></ol>')
|
||||
expect(html).toContain('type="checkbox" disabled checked')
|
||||
expect(html).toContain('<pre><code class="language-js">const x = 1</code></pre>')
|
||||
expect(html).toContain('<p>First line<br>\nsecond line</p>')
|
||||
expect(html).toMatch(/<li>\s*<p>parent<\/p>\s*<ul>\s*<li>child<\/li>\s*<\/ul>\s*<\/li>/)
|
||||
expect(html).toContain('class="task-list-item')
|
||||
expect(html).toContain('type="checkbox"')
|
||||
expect(html).toContain('checked=""')
|
||||
expect(html).toContain('<pre><code class="language-js">const x = 1\n</code></pre>')
|
||||
expect(html).toContain('<strong>bold</strong>')
|
||||
expect(html).toContain('target="_blank"')
|
||||
expect(html).toContain('rel="noopener noreferrer"')
|
||||
expect(html).not.toContain('<script>')
|
||||
expect(html).toContain('<script>alert(1)</script>')
|
||||
})
|
||||
|
||||
it('inserts markdown around selections and prefixes selected lines', () => {
|
||||
|
||||
Reference in New Issue
Block a user