2022-07-08 08:32:20 +00:00
|
|
|
import { marked } from 'marked'
|
|
|
|
import markedMfm from '../src/index.js'
|
|
|
|
|
|
|
|
describe('marked-mfm', () => {
|
|
|
|
test('inline', () => {
|
2022-07-08 08:39:48 +00:00
|
|
|
marked.use(markedMfm)
|
2022-07-08 08:32:20 +00:00
|
|
|
expect(marked('$[x2 this text is bigger]')).toBe('<p><span style="display: inline-block" class="x2">this text is bigger</span></p>\n')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('nested', () => {
|
2022-07-08 08:39:48 +00:00
|
|
|
marked.use(markedMfm)
|
2022-07-08 08:32:20 +00:00
|
|
|
expect(marked('$[twitch twitch $[sparkle sparkle]]')).toBe('<p><span style="display: inline-block" class="twitch">twitch <span style="display: inline-block" class="sparkle">sparkle</span></span></p>\n')
|
|
|
|
})
|
2022-07-08 08:59:00 +00:00
|
|
|
|
|
|
|
test('invalid', () => {
|
|
|
|
marked.use(markedMfm)
|
|
|
|
expect(marked('$[invalid $[x2 test]]')).toBe('<p>$[invalid <span style="display: inline-block" class="x2">test</span>]</p>\n')
|
|
|
|
})
|
2022-07-08 08:32:20 +00:00
|
|
|
})
|