We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c16890a commit 78c1034Copy full SHA for 78c1034
packages/gitbook/src/components/DocumentView/CodeBlock/highlight.ts
@@ -77,10 +77,17 @@ export async function highlight(
77
themes: [theme],
78
});
79
80
+ let tokenizeMaxLineLength = 400;
81
+ // In some cases, people will use unindented code blocks with a single line.
82
+ // In this case, we can safely increase the max line length to avoid not highlighting the code.
83
+ if (block.nodes.length === 1) {
84
+ tokenizeMaxLineLength = 5000;
85
+ }
86
+
87
const lines = highlighter.codeToTokensBase(code, {
88
lang: langName,
89
theme,
- tokenizeMaxLineLength: 400,
90
+ tokenizeMaxLineLength,
91
92
93
let currentIndex = 0;
0 commit comments