MCPcopy Index your code
hub / github.com/marktext/marktext / computeLineCount

Function computeLineCount

packages/muya/src/utils/codeBlockLineNumbers.ts:10–17  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

8const LF = 10;
9
10export function computeLineCount(text: string): number {
11 let count = 1;
12 for (let i = 0; i < text.length; i++) {
13 if (text.charCodeAt(i) === LF)
14 count++;
15 }
16 return count;
17}
18
19export const LINE_NUMBERS_ROWS_CLASS = 'mu-line-numbers-rows';
20

Callers 2

_updateLineNumbersMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected