( textContent: string, language: Language, highlighter: Highlighter, callback: (text: string, style: string, from: number, to: number) => void, options?: Record<string, any>, )
| 16 | } from '../constants' |
| 17 | |
| 18 | export function runmode( |
| 19 | textContent: string, |
| 20 | language: Language, |
| 21 | highlighter: Highlighter, |
| 22 | callback: (text: string, style: string, from: number, to: number) => void, |
| 23 | options?: Record<string, any>, |
| 24 | ) { |
| 25 | const tree = language.parser.parse(textContent) |
| 26 | let pos = 0 |
| 27 | highlightTree(tree, highlighter, (from, to, classes) => { |
| 28 | from > pos && callback(textContent.slice(pos, from), '', pos, from) |
| 29 | |
| 30 | callback(textContent.slice(from, to), classes, from, to) |
| 31 | pos = to |
| 32 | }) |
| 33 | pos != tree.length && callback(textContent.slice(pos, tree.length), '', pos, tree.length) |
| 34 | } |
| 35 | export interface CodeBlockHTMLSerializerWithOptions extends HTMLSerializerWithOptions { |
| 36 | editor: Editor |
| 37 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…