| 1 | import MarkdownExit from 'markdown-exit' |
| 2 | import * as shiki from 'shiki' |
| 3 | import { expect, it } from 'vitest' |
| 4 | import { MarkdownItCodeblocks } from '.' |
| 5 | import MarkdownItShiki from '../shiki' |
| 6 | |
| 7 | it('keeps languages containing `#` or `+`', async () => { |
| 8 | const md = MarkdownExit({ html: true }) |
| 9 | const options = { |
| 10 | data: { config: {} }, |
| 11 | mode: 'dev', |
| 12 | utils: { |
| 13 | shiki, |
| 14 | shikiOptions: { theme: 'nord' }, |
| 15 | }, |
| 16 | } as any |
| 17 | |
| 18 | md.use(await MarkdownItShiki(options)) |
| 19 | md.use(MarkdownItCodeblocks, options, []) |
| 20 | |
| 21 | const result = await md.renderAsync([ |
| 22 | '```c# [Program.cs] {1}', |
| 23 | 'using System;', |
| 24 | '```', |
| 25 | ].join('\n')) |
| 26 | |
| 27 | expect(result).toContain('title="Program.cs"') |
| 28 | expect(result).toContain(':ranges=\'["1"]\'') |
| 29 | expect(result).toContain('<code class="language-c#">') |
| 30 | expect(result).toContain('<span style="color:#81A1C1">using</span>') |
| 31 | }) |
| 32 |