MCPcopy Create free account
hub / github.com/danvk/webdiff / openNode

Method openNode

webdiff/static/js/highlight.min.js:20–24  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

18const i=e=>!!e.scope||e.sublanguage&&e.language;class s{constructor(e,t){
19this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){
20this.buffer+=n(e)}openNode(e){if(!i(e))return;let t=""
21;t=e.sublanguage?"language-"+e.language:((e,{prefix:t})=>{if(e.includes(".")){
22const a=e.split(".")
23;return[`${t}${a.shift()}`,...a.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")
24}return`${t}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(t)}
25closeNode(e){i(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){
26this.buffer+=`<span class="${e}">`}}const o=(e={})=>{const t={children:[]}
27;return Object.assign(t,e),t};class l{constructor(){

Callers 4

_walkMethod · 0.45
addKeywordMethod · 0.45
pFunction · 0.45
TFunction · 0.45

Calls 2

spanMethod · 0.95
iFunction · 0.70

Tested by

no test coverage detected