summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/test/shiki.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/markdown/remark/test/shiki.test.js')
-rw-r--r--packages/markdown/remark/test/shiki.test.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/markdown/remark/test/shiki.test.js b/packages/markdown/remark/test/shiki.test.js
index d98028202..45582d752 100644
--- a/packages/markdown/remark/test/shiki.test.js
+++ b/packages/markdown/remark/test/shiki.test.js
@@ -109,4 +109,32 @@ describe('shiki syntax highlighting', () => {
// Doesn't have `color` or `background-color` properties.
assert.doesNotMatch(code, /color:/);
});
+
+ it('the highlighter supports lang alias', async () => {
+ const highlighter = await createShikiHighlighter({
+ langAlias: {
+ cjs: 'javascript',
+ },
+ });
+
+ const html = await highlighter.codeToHtml(`let test = "some string"`, 'cjs', {
+ attributes: { 'data-foo': 'bar', autofocus: true },
+ });
+
+ assert.match(html, /data-language="cjs"/);
+ });
+
+ it('the markdown processsor support lang alias', async () => {
+ const processor = await createMarkdownProcessor({
+ shikiConfig: {
+ langAlias: {
+ cjs: 'javascript',
+ },
+ },
+ });
+
+ const { code } = await processor.render('```cjs\nlet foo = "bar"\n```');
+
+ assert.match(code, /data-language="cjs"/);
+ });
});