From 43e0b68dd3ab9fbf760e93152e89e4ee2d1963b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Mar 2026 06:34:30 +0000 Subject: [PATCH 1/2] fix loading: use JSON blob for embedded wiki content The - - - - - - - - - - - - - + - + \ No newline at end of file From 99dd26aae2def737934a66af0bed0f52cd3bc583 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Mar 2026 06:49:32 +0000 Subject: [PATCH 2/2] fix wiki rendering: bundle JS locally and fix marked v12 renderer API The wiki page was stuck on "Loading..." for two reasons: 1. External CDN scripts (marked.js, highlight.js) were unreachable in some environments, preventing the markdown renderer from loading. Fixed by bundling the libraries locally. 2. The marked v12 custom renderer for `code` and `text` assumed token objects, but marked v12 sometimes passes plain strings. Added typeof guards to handle both cases. https://claude.ai/code/session_01BgQZR5yFQxP94gNvDkvavs --- .gitignore | 5 +++++ docs/github.min.css | 10 ++++++++++ docs/highlight.bundle.js | 2 ++ docs/index.html | 15 ++++++--------- docs/marked.min.js | 6 ++++++ 5 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 docs/github.min.css create mode 100644 docs/highlight.bundle.js create mode 100644 docs/marked.min.js diff --git a/.gitignore b/.gitignore index b7faf40..31c5715 100644 --- a/.gitignore +++ b/.gitignore @@ -205,3 +205,8 @@ cython_debug/ marimo/_static/ marimo/_lsp/ __marimo__/ + +# Node.js +node_modules/ +package.json +package-lock.json diff --git a/docs/github.min.css b/docs/github.min.css new file mode 100644 index 0000000..275239a --- /dev/null +++ b/docs/github.min.css @@ -0,0 +1,10 @@ +pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*! + Theme: GitHub + Description: Light theme as seen on github.com + Author: github.com + Maintainer: @Hirse + Updated: 2021-05-15 + + Outdated base version: https://github.com/primer/github-syntax-light + Current colors taken from GitHub's CSS +*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0} \ No newline at end of file diff --git a/docs/highlight.bundle.js b/docs/highlight.bundle.js new file mode 100644 index 0000000..cfeb520 --- /dev/null +++ b/docs/highlight.bundle.js @@ -0,0 +1,2 @@ +(()=>{var at=Object.create;var ye=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ft=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var ht=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var dt=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of ut(t))!gt.call(e,d)&&d!==n&&ye(e,d,{get:()=>t[d],enumerable:!(a=lt(t,d))||a.enumerable});return e};var pt=(e,t,n)=>(n=e!=null?at(ft(e)):{},dt(t||!e||!e.__esModule?ye(n,"default",{value:e,enumerable:!0}):n,e));var Ge=ht((on,Ke)=>{function me(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],a=typeof n;(a==="object"||a==="function")&&!Object.isFrozen(n)&&me(n)}),e}var ee=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Be(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function D(e,...t){let n=Object.create(null);for(let a in e)n[a]=e[a];return t.forEach(function(a){for(let d in a)n[d]=a[d]}),n}var bt="",Ae=e=>!!e.scope,Et=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((a,d)=>`${a}${"_".repeat(d+1)}`)].join(" ")}return`${t}${e}`},ae=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Be(t)}openNode(t){if(!Ae(t))return;let n=Et(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Ae(t)&&(this.buffer+=bt)}value(){return this.buffer}span(t){this.buffer+=``}},Ne=(e={})=>{let t={children:[]};return Object.assign(t,e),t},le=class e{constructor(){this.rootNode=Ne(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=Ne({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(a=>this._walk(t,a)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},ue=class extends le{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let a=t.root;n&&(a.scope=`language:${n}`),this.add(a)}toHTML(){return new ae(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function j(e){return e?typeof e=="string"?e:e.source:null}function ke(e){return U("(?=",e,")")}function _t(e){return U("(?:",e,")*")}function St(e){return U("(?:",e,")?")}function U(...e){return e.map(n=>j(n)).join("")}function wt(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function ge(...e){return"("+(wt(e).capture?"":"?:")+e.map(a=>j(a)).join("|")+")"}function Ie(e){return new RegExp(e.toString()+"|").exec("").length-1}function Rt(e,t){let n=e&&e.exec(t);return n&&n.index===0}var yt=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function he(e,{joinWith:t}){let n=0;return e.map(a=>{n+=1;let d=n,_=j(a),c="";for(;_.length>0;){let i=yt.exec(_);if(!i){c+=_;break}c+=_.substring(0,i.index),_=_.substring(i.index+i[0].length),i[0][0]==="\\"&&i[1]?c+="\\"+String(Number(i[1])+d):(c+=i[0],i[0]==="("&&n++)}return c}).map(a=>`(${a})`).join(t)}var At=/\b\B/,Le="[a-zA-Z]\\w*",de="[a-zA-Z_]\\w*",ve="\\b\\d+(\\.\\d+)?",Ce="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",De="\\b(0b[01]+)",Nt="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Mt=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=U(t,/.*\b/,e.binary,/\b.*/)),D({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,a)=>{n.index!==0&&a.ignoreMatch()}},e)},W={begin:"\\\\[\\s\\S]",relevance:0},xt={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[W]},Ot={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[W]},Tt={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ne=function(e,t,n={}){let a=D({scope:"comment",begin:e,end:t,contains:[]},n);a.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let d=ge("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return a.contains.push({begin:U(/[ ]+/,"(",d,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a},mt=ne("//","$"),Bt=ne("/\\*","\\*/"),kt=ne("#","$"),It={scope:"number",begin:ve,relevance:0},Lt={scope:"number",begin:Ce,relevance:0},vt={scope:"number",begin:De,relevance:0},Ct={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[W,{begin:/\[/,end:/\]/,relevance:0,contains:[W]}]},Dt={scope:"title",begin:Le,relevance:0},Ht={scope:"title",begin:de,relevance:0},Pt={begin:"\\.\\s*"+de,relevance:0},Ut=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},q=Object.freeze({__proto__:null,APOS_STRING_MODE:xt,BACKSLASH_ESCAPE:W,BINARY_NUMBER_MODE:vt,BINARY_NUMBER_RE:De,COMMENT:ne,C_BLOCK_COMMENT_MODE:Bt,C_LINE_COMMENT_MODE:mt,C_NUMBER_MODE:Lt,C_NUMBER_RE:Ce,END_SAME_AS_BEGIN:Ut,HASH_COMMENT_MODE:kt,IDENT_RE:Le,MATCH_NOTHING_RE:At,METHOD_GUARD:Pt,NUMBER_MODE:It,NUMBER_RE:ve,PHRASAL_WORDS_MODE:Tt,QUOTE_STRING_MODE:Ot,REGEXP_MODE:Ct,RE_STARTERS_RE:Nt,SHEBANG:Mt,TITLE_MODE:Dt,UNDERSCORE_IDENT_RE:de,UNDERSCORE_TITLE_MODE:Ht});function $t(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Kt(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Gt(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=$t,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function zt(e,t){Array.isArray(e.illegal)&&(e.illegal=ge(...e.illegal))}function Ft(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function jt(e,t){e.relevance===void 0&&(e.relevance=1)}var Wt=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(a=>{delete e[a]}),e.keywords=n.keywords,e.begin=U(n.beforeMatch,ke(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Yt=["of","and","for","in","not","or","if","then","parent","list","value"],Xt="keyword";function He(e,t,n=Xt){let a=Object.create(null);return typeof e=="string"?d(n,e.split(" ")):Array.isArray(e)?d(n,e):Object.keys(e).forEach(function(_){Object.assign(a,He(e[_],t,_))}),a;function d(_,c){t&&(c=c.map(i=>i.toLowerCase())),c.forEach(function(i){let o=i.split("|");a[o[0]]=[_,Zt(o[0],o[1])]})}}function Zt(e,t){return t?Number(t):Jt(e)?0:1}function Jt(e){return Yt.includes(e.toLowerCase())}var Me={},P=e=>{console.error(e)},xe=(e,...t)=>{console.log(`WARN: ${e}`,...t)},G=(e,t)=>{Me[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Me[`${e}/${t}`]=!0)},te=new Error;function Pe(e,t,{key:n}){let a=0,d=e[n],_={},c={};for(let i=1;i<=t.length;i++)c[i+a]=d[i],_[i+a]=!0,a+=Ie(t[i-1]);e[n]=c,e[n]._emit=_,e[n]._multi=!0}function Qt(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw P("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),te;if(typeof e.beginScope!="object"||e.beginScope===null)throw P("beginScope must be object"),te;Pe(e,e.begin,{key:"beginScope"}),e.begin=he(e.begin,{joinWith:""})}}function Vt(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw P("skip, excludeEnd, returnEnd not compatible with endScope: {}"),te;if(typeof e.endScope!="object"||e.endScope===null)throw P("endScope must be object"),te;Pe(e,e.end,{key:"endScope"}),e.end=he(e.end,{joinWith:""})}}function qt(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function en(e){qt(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Qt(e),Vt(e)}function tn(e){function t(c,i){return new RegExp(j(c),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(i?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(i,o){o.position=this.position++,this.matchIndexes[this.matchAt]=o,this.regexes.push([o,i]),this.matchAt+=Ie(i)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let i=this.regexes.map(o=>o[1]);this.matcherRe=t(he(i,{joinWith:"|"}),!0),this.lastIndex=0}exec(i){this.matcherRe.lastIndex=this.lastIndex;let o=this.matcherRe.exec(i);if(!o)return null;let E=o.findIndex((N,M)=>M>0&&N!==void 0),p=this.matchIndexes[E];return o.splice(0,E),Object.assign(o,p)}}class a{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(i){if(this.multiRegexes[i])return this.multiRegexes[i];let o=new n;return this.rules.slice(i).forEach(([E,p])=>o.addRule(E,p)),o.compile(),this.multiRegexes[i]=o,o}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(i,o){this.rules.push([i,o]),o.type==="begin"&&this.count++}exec(i){let o=this.getMatcher(this.regexIndex);o.lastIndex=this.lastIndex;let E=o.exec(i);if(this.resumingScanAtSamePosition()&&!(E&&E.index===this.lastIndex)){let p=this.getMatcher(0);p.lastIndex=this.lastIndex+1,E=p.exec(i)}return E&&(this.regexIndex+=E.position+1,this.regexIndex===this.count&&this.considerAll()),E}}function d(c){let i=new a;return c.contains.forEach(o=>i.addRule(o.begin,{rule:o,type:"begin"})),c.terminatorEnd&&i.addRule(c.terminatorEnd,{type:"end"}),c.illegal&&i.addRule(c.illegal,{type:"illegal"}),i}function _(c,i){let o=c;if(c.isCompiled)return o;[Kt,Ft,en,Wt].forEach(p=>p(c,i)),e.compilerExtensions.forEach(p=>p(c,i)),c.__beforeBegin=null,[Gt,zt,jt].forEach(p=>p(c,i)),c.isCompiled=!0;let E=null;return typeof c.keywords=="object"&&c.keywords.$pattern&&(c.keywords=Object.assign({},c.keywords),E=c.keywords.$pattern,delete c.keywords.$pattern),E=E||/\w+/,c.keywords&&(c.keywords=He(c.keywords,e.case_insensitive)),o.keywordPatternRe=t(E,!0),i&&(c.begin||(c.begin=/\B|\b/),o.beginRe=t(o.begin),!c.end&&!c.endsWithParent&&(c.end=/\B|\b/),c.end&&(o.endRe=t(o.end)),o.terminatorEnd=j(o.end)||"",c.endsWithParent&&i.terminatorEnd&&(o.terminatorEnd+=(c.end?"|":"")+i.terminatorEnd)),c.illegal&&(o.illegalRe=t(c.illegal)),c.contains||(c.contains=[]),c.contains=[].concat(...c.contains.map(function(p){return nn(p==="self"?c:p)})),c.contains.forEach(function(p){_(p,o)}),c.starts&&_(c.starts,i),o.matcher=d(o),o}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=D(e.classNameAliases||{}),_(e)}function Ue(e){return e?e.endsWithParent||Ue(e.starts):!1}function nn(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return D(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ue(e)?D(e,{starts:e.starts?D(e.starts):null}):Object.isFrozen(e)?D(e):e}var sn="11.9.0",fe=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},oe=Be,Oe=D,Te=Symbol("nomatch"),rn=7,$e=function(e){let t=Object.create(null),n=Object.create(null),a=[],d=!0,_="Could not find the language '{}', did you forget to load/include a language module?",c={disableAutodetect:!0,name:"Plain text",contains:[]},i={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:ue};function o(s){return i.noHighlightRe.test(s)}function E(s){let u=s.className+" ";u+=s.parentNode?s.parentNode.className:"";let h=i.languageDetectRe.exec(u);if(h){let S=v(h[1]);return S||(xe(_.replace("{}",h[1])),xe("Falling back to no-highlight mode for this block.",s)),S?h[1]:"no-highlight"}return u.split(/\s+/).find(S=>o(S)||v(S))}function p(s,u,h){let S="",R="";typeof u=="object"?(S=s,h=u.ignoreIllegals,R=u.language):(G("10.7.0","highlight(lang, code, ...args) has been deprecated."),G("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),R=s,S=u),h===void 0&&(h=!0);let O={code:S,language:R};Z("before:highlight",O);let C=O.result?O.result:N(O.language,O.code,h);return C.code=O.code,Z("after:highlight",C),C}function N(s,u,h,S){let R=Object.create(null);function O(r,l){return r.keywords[l]}function C(){if(!f.keywords){y.addText(w);return}let r=0;f.keywordPatternRe.lastIndex=0;let l=f.keywordPatternRe.exec(w),g="";for(;l;){g+=w.substring(r,l.index);let b=k.case_insensitive?l[0].toLowerCase():l[0],A=O(f,b);if(A){let[I,ct]=A;if(y.addText(g),g="",R[b]=(R[b]||0)+1,R[b]<=rn&&(V+=ct),I.startsWith("_"))g+=l[0];else{let ot=k.classNameAliases[I]||I;B(l[0],ot)}}else g+=l[0];r=f.keywordPatternRe.lastIndex,l=f.keywordPatternRe.exec(w)}g+=w.substring(r),y.addText(g)}function J(){if(w==="")return;let r=null;if(typeof f.subLanguage=="string"){if(!t[f.subLanguage]){y.addText(w);return}r=N(f.subLanguage,w,!0,Re[f.subLanguage]),Re[f.subLanguage]=r._top}else r=L(w,f.subLanguage.length?f.subLanguage:null);f.relevance>0&&(V+=r.relevance),y.__addSublanguage(r._emitter,r.language)}function x(){f.subLanguage!=null?J():C(),w=""}function B(r,l){r!==""&&(y.startScope(l),y.addText(r),y.endScope())}function Ee(r,l){let g=1,b=l.length-1;for(;g<=b;){if(!r._emit[g]){g++;continue}let A=k.classNameAliases[r[g]]||r[g],I=l[g];A?B(I,A):(w=I,C(),w=""),g++}}function _e(r,l){return r.scope&&typeof r.scope=="string"&&y.openNode(k.classNameAliases[r.scope]||r.scope),r.beginScope&&(r.beginScope._wrap?(B(w,k.classNameAliases[r.beginScope._wrap]||r.beginScope._wrap),w=""):r.beginScope._multi&&(Ee(r.beginScope,l),w="")),f=Object.create(r,{parent:{value:f}}),f}function Se(r,l,g){let b=Rt(r.endRe,g);if(b){if(r["on:end"]){let A=new ee(r);r["on:end"](l,A),A.isMatchIgnored&&(b=!1)}if(b){for(;r.endsParent&&r.parent;)r=r.parent;return r}}if(r.endsWithParent)return Se(r.parent,l,g)}function tt(r){return f.matcher.regexIndex===0?(w+=r[0],1):(ce=!0,0)}function nt(r){let l=r[0],g=r.rule,b=new ee(g),A=[g.__beforeBegin,g["on:begin"]];for(let I of A)if(I&&(I(r,b),b.isMatchIgnored))return tt(l);return g.skip?w+=l:(g.excludeBegin&&(w+=l),x(),!g.returnBegin&&!g.excludeBegin&&(w=l)),_e(g,r),g.returnBegin?0:l.length}function st(r){let l=r[0],g=u.substring(r.index),b=Se(f,r,g);if(!b)return Te;let A=f;f.endScope&&f.endScope._wrap?(x(),B(l,f.endScope._wrap)):f.endScope&&f.endScope._multi?(x(),Ee(f.endScope,r)):A.skip?w+=l:(A.returnEnd||A.excludeEnd||(w+=l),x(),A.excludeEnd&&(w=l));do f.scope&&y.closeNode(),!f.skip&&!f.subLanguage&&(V+=f.relevance),f=f.parent;while(f!==b.parent);return b.starts&&_e(b.starts,r),A.returnEnd?0:l.length}function it(){let r=[];for(let l=f;l!==k;l=l.parent)l.scope&&r.unshift(l.scope);r.forEach(l=>y.openNode(l))}let Q={};function we(r,l){let g=l&&l[0];if(w+=r,g==null)return x(),0;if(Q.type==="begin"&&l.type==="end"&&Q.index===l.index&&g===""){if(w+=u.slice(l.index,l.index+1),!d){let b=new Error(`0 width match regex (${s})`);throw b.languageName=s,b.badRule=Q.rule,b}return 1}if(Q=l,l.type==="begin")return nt(l);if(l.type==="illegal"&&!h){let b=new Error('Illegal lexeme "'+g+'" for mode "'+(f.scope||"")+'"');throw b.mode=f,b}else if(l.type==="end"){let b=st(l);if(b!==Te)return b}if(l.type==="illegal"&&g==="")return 1;if(re>1e5&&re>l.index*3)throw new Error("potential infinite loop, way more iterations than matches");return w+=g,g.length}let k=v(s);if(!k)throw P(_.replace("{}",s)),new Error('Unknown language: "'+s+'"');let rt=tn(k),ie="",f=S||rt,Re={},y=new i.__emitter(i);it();let w="",V=0,H=0,re=0,ce=!1;try{if(k.__emitTokens)k.__emitTokens(u,y);else{for(f.matcher.considerAll();;){re++,ce?ce=!1:f.matcher.considerAll(),f.matcher.lastIndex=H;let r=f.matcher.exec(u);if(!r)break;let l=u.substring(H,r.index),g=we(l,r);H=r.index+g}we(u.substring(H))}return y.finalize(),ie=y.toHTML(),{language:s,value:ie,relevance:V,illegal:!1,_emitter:y,_top:f}}catch(r){if(r.message&&r.message.includes("Illegal"))return{language:s,value:oe(u),illegal:!0,relevance:0,_illegalBy:{message:r.message,index:H,context:u.slice(H-100,H+100),mode:r.mode,resultSoFar:ie},_emitter:y};if(d)return{language:s,value:oe(u),illegal:!1,relevance:0,errorRaised:r,_emitter:y,_top:f};throw r}}function M(s){let u={value:oe(s),illegal:!1,relevance:0,_top:c,_emitter:new i.__emitter(i)};return u._emitter.addText(s),u}function L(s,u){u=u||i.languages||Object.keys(t);let h=M(s),S=u.filter(v).filter(be).map(x=>N(x,s,!1));S.unshift(h);let R=S.sort((x,B)=>{if(x.relevance!==B.relevance)return B.relevance-x.relevance;if(x.language&&B.language){if(v(x.language).supersetOf===B.language)return 1;if(v(B.language).supersetOf===x.language)return-1}return 0}),[O,C]=R,J=O;return J.secondBest=C,J}function T(s,u,h){let S=u&&n[u]||h;s.classList.add("hljs"),s.classList.add(`language-${S}`)}function m(s){let u=null,h=E(s);if(o(h))return;if(Z("before:highlightElement",{el:s,language:h}),s.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",s);return}if(s.children.length>0&&(i.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(s)),i.throwUnescapedHTML))throw new fe("One of your code blocks includes unescaped HTML.",s.innerHTML);u=s;let S=u.textContent,R=h?p(S,{language:h,ignoreIllegals:!0}):L(S);s.innerHTML=R.value,s.dataset.highlighted="yes",T(s,h,R.language),s.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(s.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),Z("after:highlightElement",{el:s,result:R,text:S})}function F(s){i=Oe(i,s)}let $=()=>{K(),G("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function se(){K(),G("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let X=!1;function K(){if(document.readyState==="loading"){X=!0;return}document.querySelectorAll(i.cssSelector).forEach(m)}function Ye(){X&&K()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",Ye,!1);function Xe(s,u){let h=null;try{h=u(e)}catch(S){if(P("Language definition for '{}' could not be registered.".replace("{}",s)),d)P(S);else throw S;h=c}h.name||(h.name=s),t[s]=h,h.rawDefinition=u.bind(null,e),h.aliases&&pe(h.aliases,{languageName:s})}function Ze(s){delete t[s];for(let u of Object.keys(n))n[u]===s&&delete n[u]}function Je(){return Object.keys(t)}function v(s){return s=(s||"").toLowerCase(),t[s]||t[n[s]]}function pe(s,{languageName:u}){typeof s=="string"&&(s=[s]),s.forEach(h=>{n[h.toLowerCase()]=u})}function be(s){let u=v(s);return u&&!u.disableAutodetect}function Qe(s){s["before:highlightBlock"]&&!s["before:highlightElement"]&&(s["before:highlightElement"]=u=>{s["before:highlightBlock"](Object.assign({block:u.el},u))}),s["after:highlightBlock"]&&!s["after:highlightElement"]&&(s["after:highlightElement"]=u=>{s["after:highlightBlock"](Object.assign({block:u.el},u))})}function Ve(s){Qe(s),a.push(s)}function qe(s){let u=a.indexOf(s);u!==-1&&a.splice(u,1)}function Z(s,u){let h=s;a.forEach(function(S){S[h]&&S[h](u)})}function et(s){return G("10.7.0","highlightBlock will be removed entirely in v12.0"),G("10.7.0","Please use highlightElement now."),m(s)}Object.assign(e,{highlight:p,highlightAuto:L,highlightAll:K,highlightElement:m,highlightBlock:et,configure:F,initHighlighting:$,initHighlightingOnLoad:se,registerLanguage:Xe,unregisterLanguage:Ze,listLanguages:Je,getLanguage:v,registerAliases:pe,autoDetection:be,inherit:Oe,addPlugin:Ve,removePlugin:qe}),e.debugMode=function(){d=!1},e.safeMode=function(){d=!0},e.versionString=sn,e.regex={concat:U,lookahead:ke,either:ge,optional:St,anyNumberOfTimes:_t};for(let s in q)typeof q[s]=="object"&&me(q[s]);return Object.assign(e,q),e},z=$e({});z.newInstance=()=>$e({});Ke.exports=z;z.HighlightJS=z;z.default=z});var ze=pt(Ge(),1);var Y=ze.default;function Fe(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},o={className:"meta",begin:/^(>>>|\.\.\.) /},E={className:"subst",begin:/\{/,end:/\}/,keywords:i,illegal:/#/},p={begin:/\{\{/,relevance:0},N={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o,p,E]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o,p,E]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,p,E]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,p,E]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},M="[0-9](_?[0-9])*",L=`(\\b(${M}))?\\.(${M})|\\b(${M})\\.`,T=`\\b|${a.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${M})|(${L}))[eE][+-]?(${M})[jJ]?(?=${T})`},{begin:`(${L})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${T})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${T})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${T})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${T})`},{begin:`\\b(${M})[jJ](?=${T})`}]},F={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},$={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:["self",o,m,N,e.HASH_COMMENT_MODE]}]};return E.contains=[N,m,o],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[o,m,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},N,F,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[$]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,$,N]}]}}function je(e){let t=e.regex,n={},a={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});let d={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},_={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,d]};d.contains.push(c);let i={match:/\\"/},o={className:"string",begin:/'/,end:/'/},E={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},N=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],M=e.SHEBANG({binary:`(${N.join("|")})`,relevance:10}),L={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},T=["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],m=["true","false"],F={match:/(\/[a-z._-]+)+/},$=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],se=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],X=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],K=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:T,literal:m,built_in:[...$,...se,"set","shopt",...X,...K]},contains:[M,e.SHEBANG(),L,p,e.HASH_COMMENT_MODE,_,F,c,i,o,E,n]}}function We(e){let t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let d={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},_={className:"literal",begin:/\bon|off|true|false|yes|no\b/},c={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},i={begin:/\[/,end:/\]/,contains:[a,_,d,c,n,"self"],relevance:0},o=/[A-Za-z0-9_-]+/,E=/"(\\"|[^"])*"/,p=/'[^']*'/,N=t.either(o,E,p),M=t.concat(N,"(\\s*\\.\\s*",N,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{begin:M,className:"attr",starts:{end:/$/,contains:[a,i,_,d,c,n]}}]}}Y.registerLanguage("python",Fe);Y.registerLanguage("bash",je);Y.registerLanguage("ini",We);window.hljs=Y;})(); diff --git a/docs/index.html b/docs/index.html index 7857d6d..b7184ca 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ python-snacks Wiki - +