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 183f7fe commit b245726Copy full SHA for b245726
src/highlight.js
@@ -401,7 +401,12 @@ export default function(defaultAstGenerator, defaultStyle) {
401
}
402
403
// determine largest line number so that we can force minWidth on all linenumber elements
404
- const largestLineNumber = codeTree.value.length + startingLineNumber;
+ let lineCount = codeTree.value.length;
405
+ if (lineCount === 1 && codeTree.value[0].type === 'text') {
406
+ // Since codeTree for an unparsable text (e.g. 'a\na\na') is [{ type: 'text', value: 'a\na\na' }]
407
+ lineCount = codeTree.value[0].value.split('\n').length;
408
+ }
409
+ const largestLineNumber = lineCount + startingLineNumber;
410
411
const rows = processLines(
412
codeTree,
0 commit comments