MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / o

Class o

pages/viewScriptSource/libs/highlight.min.js:18–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}function r(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t]
17;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}
18const s=e=>!!e.scope||e.sublanguage&&e.language;class o{constructor(e,t){
19this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){
20this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=""
21;t=e.sublanguage?"language-"+e.language:((e,{prefix:t})=>{if(e.includes(".")){
22const n=e.split(".")
23;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")
24}return`${t}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(t)}
25closeNode(e){s(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){
26this.buffer+=`<span class="${e}">`}}const a=(e={})=>{const t={children:[]}
27;return Object.assign(t,e),t};class c{constructor(){
28this.rootNode=a(),this.stack=[this.rootNode]}get top(){
29return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected