MCPcopy Index your code
hub / github.com/postcss/postcss / terminalHighlight

Function terminalHighlight

lib/terminal-highlight.js:50–66  ·  view source on GitHub ↗
(css)

Source from the content-addressed store, hash-verified

48}
49
50function terminalHighlight(css) {
51 let processor = tokenizer(new Input(css), { ignoreErrors: true })
52 let result = ''
53 while (!processor.endOfFile()) {
54 let token = processor.nextToken()
55 let color = HIGHLIGHT_THEME[getTokenType(token, processor)]
56 if (color) {
57 result += token[1]
58 .split(/\r?\n/)
59 .map(i => color(i))
60 .join('\n')
61 } else {
62 result += token[1]
63 }
64 }
65 return result
66}
67
68terminalHighlight.registerInput = registerInput
69

Callers 1

showSourceCodeMethod · 0.85

Calls 2

getTokenTypeFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…