mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 08:34:54 -04:00
feat: import markdown-it-plugins from https://github.com/hedgedoc/markdown-it-plugins
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
1d90013344
commit
f5736dad0f
37 changed files with 2025 additions and 0 deletions
74
markdown-it-plugins/src/task-lists/index.test.ts
Normal file
74
markdown-it-plugins/src/task-lists/index.test.ts
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import MarkdownIt from 'markdown-it/lib'
|
||||
import { taskLists } from './index.js'
|
||||
import { describe, expect, it } from '@jest/globals'
|
||||
|
||||
describe('markdown-it-task-lists', () => {
|
||||
it('renders bullet correctly', () => {
|
||||
const taskListMarkdownParser = new MarkdownIt().use(taskLists)
|
||||
expect(
|
||||
taskListMarkdownParser.render(`
|
||||
- [ ] unchecked item 1
|
||||
- [ ] unchecked item 2
|
||||
- [ ] unchecked item 3
|
||||
- [x] checked item 4
|
||||
`)
|
||||
).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('renders dirty correctly', () => {
|
||||
const taskListMarkdownParser = new MarkdownIt().use(taskLists)
|
||||
expect(
|
||||
taskListMarkdownParser.render(`
|
||||
- [ ] unchecked todo item 1
|
||||
- [ ]
|
||||
- [ ] not a todo item 2
|
||||
- [ x] not a todo item 3
|
||||
- [x ] not a todo item 4
|
||||
- [ x ] not a todo item 5
|
||||
- [x] todo item 6
|
||||
`)
|
||||
).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('renders mixedNested correctly', () => {
|
||||
const taskListMarkdownParser = new MarkdownIt().use(taskLists)
|
||||
expect(
|
||||
taskListMarkdownParser.render(`
|
||||
# Test 1
|
||||
|
||||
1. foo
|
||||
* [ ] nested unchecked item 1
|
||||
* not a todo item 2
|
||||
* not a todo item 3
|
||||
* [x] nested checked item 4
|
||||
2. bar
|
||||
3. spam
|
||||
|
||||
# Test 2
|
||||
|
||||
- foo
|
||||
- [ ] nested unchecked item 1
|
||||
- [ ] nested unchecked item 2
|
||||
- [x] nested checked item 3
|
||||
- [X] nested checked item 4
|
||||
`)
|
||||
).toMatchSnapshot()
|
||||
})
|
||||
it('renders ordered correctly', () => {
|
||||
const taskListMarkdownParser = new MarkdownIt().use(taskLists)
|
||||
expect(
|
||||
taskListMarkdownParser.render(`
|
||||
1. [x] checked ordered 1
|
||||
2. [ ] unchecked ordered 2
|
||||
3. [x] checked ordered 3
|
||||
4. [ ] unchecked ordered 4
|
||||
`)
|
||||
).toMatchSnapshot()
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue