File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/components/DocumentView/CodeBlock Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ type InlineIndexed = { inline: any; start: number; end: number };
30
30
type PositionedToken = ThemedToken & { start : number ; end : number } ;
31
31
32
32
let lineCount = 0 ;
33
-
34
- const LINE_LIMIT = 500 ;
33
+ const LINE_LIMIT = 1000 ;
34
+ const renderer = asyncMutexFunction ( ) ;
35
35
36
36
/**
37
37
* Highlight a code block while preserving inline elements.
@@ -60,10 +60,10 @@ export async function highlight(block: DocumentBlockCode): Promise<HighlightLine
60
60
const highlighter = await loadHighlighter ( ) ;
61
61
await loadHighlighterLanguage ( highlighter , langName ) ;
62
62
63
- const lines = highlighter . codeToTokensBase ( code , {
63
+ const lines = await renderer . runBlocking ( async ( ) => highlighter . codeToTokensBase ( code , {
64
64
lang : langName ,
65
65
tokenizeMaxLineLength : 120 ,
66
- } ) ;
66
+ } ) ) ;
67
67
68
68
console . log (
69
69
`${ block . key } lines:${ lineCount } block has ${
You can’t perform that action at this time.
0 commit comments