File tree Expand file tree Collapse file tree 1 file changed +13
-19
lines changed Expand file tree Collapse file tree 1 file changed +13
-19
lines changed Original file line number Diff line number Diff line change 1
- /**
2
- * @import {LanguageFn} from 'lowlight'
3
- */
4
-
5
1
import assert from 'node:assert/strict'
6
2
import test from 'node:test'
7
- import { common } from 'lowlight'
8
3
import rehypeHighlight from 'rehype-highlight'
9
4
import rehypeParse from 'rehype-parse'
10
5
import rehypeStringify from 'rehype-stringify'
@@ -481,13 +476,23 @@ test('rehypeHighlight', async function (t) {
481
476
await t . test ( 'should register languages' , async function ( ) {
482
477
const file = await unified ( )
483
478
. use ( rehypeParse , { fragment : true } )
484
- . use ( rehypeHighlight , { languages : { ...common , test : testLang } } )
479
+ . use ( rehypeHighlight , {
480
+ languages : {
481
+ test ( ) {
482
+ return {
483
+ aliases : [ ] ,
484
+ contains : [ ] ,
485
+ keywords : { keyword : 'bravo' }
486
+ }
487
+ }
488
+ }
489
+ } )
485
490
. use ( rehypeStringify )
486
491
. process (
487
492
[
488
493
'<h1>Hello World!</h1>' ,
489
494
'' ,
490
- '<pre><code class="language-scss">test normal text </code></pre>'
495
+ '<pre><code class="language-test">alpha bravo charlie </code></pre>'
491
496
] . join ( '\n' )
492
497
)
493
498
@@ -496,19 +501,8 @@ test('rehypeHighlight', async function (t) {
496
501
[
497
502
'<h1>Hello World!</h1>' ,
498
503
'' ,
499
- '<pre><code class="hljs language-scss"> test <span class="hljs-attribute">normal</span> <span class="hljs-selector-tag">text </span></code></pre>'
504
+ '<pre><code class="hljs language-test">alpha <span class="hljs-keyword">bravo </span> charlie </code></pre>'
500
505
] . join ( '\n' )
501
506
)
502
-
503
- /**
504
- * @type {LanguageFn }
505
- */
506
- function testLang ( ) {
507
- return {
508
- aliases : [ 'test' ] ,
509
- contains : [ ] ,
510
- keywords : { keyword : 'test' }
511
- }
512
- }
513
507
} )
514
508
} )
You can’t perform that action at this time.
0 commit comments