The server's 2.0 tokens and its CodeMirror build, pinned
ui/tokens.css from the server's dev (tokens.lock.json; repin to the beta tag at release). scripts/fetch-vendor.sh copies the server's vendored CodeMirror and Lezer modules into ui/vendor/, each checked against the server's own pin first, with the bare module names rewritten to sibling files (the page has no import map); vendor.lock.json records both hashes, and the script with no argument verifies the copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
21 files changed
+224
-35
No files matched your search
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/* esm.sh - @codemirror/lang-markdown@6.5.2 */
|
||||
import{EditorSelection as N,countColumn as U,Prec as zt,EditorState as Rt}from"./cm-state.mjs";import{EditorView as Tt,keymap as Dt}from"./cm-view.mjs";import{defineLanguageFacet as Ft,foldNodeProp as ut,indentNodeProp as Xt,languageDataProp as $t,foldService as Ut,syntaxTree as j,Language as jt,LanguageDescription as at,ParseContext as _t,indentUnit as qt,LanguageSupport as lt}from"./cm-language.mjs";import{CompletionContext as Qt}from"./cm-autocomplete.mjs";import{NodeType as J,NodeProp as D,NodeSet as Oe,Tree as x,Parser as bt,IterMode as Ce,parseMixed as wt}from"./lezer-common.mjs";import{styleTags as ze,tags as m,Tag as St}from"./lezer-highlight.mjs";var Q=class t{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new t(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.blankFirstLine=!1,this.hashProp=[[D.contextHash,s]]}addChild(e,r){e.prop(D.contextHash)!=this.hash&&(e=new x(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new x(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new x(J.none,s,i,o,this.hashProp)})}},u;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(u||(u={}));var te=class{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}},re=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return R(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let s=r;s<e;s++)n+=this.text.charCodeAt(s)==9?4-n%4:1;return n}findColumn(e){let r=0;for(let n=0;r<this.text.length&&n<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return r}scrub(){if(!this.baseIndent)return this.text;let e="";for(let r=0;r<this.basePos;r++)e+=" ";return e+this.text.slice(this.basePos)}};function Ae(t,e,r){if(r.pos==r.text.length||t!=e.block&&r.indent>=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==u.OrderedList?ce:pe)(r,e,!1);return n>0&&(t.type!=u.BulletList||de(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}var Re={[u.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(g(u.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(A(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[u.ListItem](t,e,r){return(r.next<0?t.blankFirstLine&&t.children.length==1:r.indent<r.baseIndent+t.value)?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[u.OrderedList]:Ae,[u.BulletList]:Ae,[u.Document](){return!0}};function A(t){return t==32||t==9||t==10||t==13}function R(t,e=0){for(;e<t.length&&A(t.charCodeAt(e));)e++;return e}function xe(t,e,r){for(;e>r&&A(t.charCodeAt(e-1));)e--;return e}function Te(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let r=e;r<tLine truncated
|
||||
`+r.scrub(),i=this.advance(s);return i>-1&&i<s.length?this.complete(e,n,i):!1}finish(e,r){return(this.stage==2||this.stage==3)&&R(r.content,this.pos)==r.content.length?this.complete(e,r,r.content.length):!1}complete(e,r,n){return e.addLeafElement(r,g(u.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Ke(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(g(u.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Ge(e,R(e,this.pos),this.start)))return-1}else if(this.stage==2){let r=R(e,this.pos),n=0;if(r>this.pos){let s=Ve(e,r,this.start);if(s){let i=W(e,s.to-this.start);i>0&&(this.nextStage(s),n=i)}}return n||(n=W(e,this.pos)),n>0&&n<e.length?n:-1}else return W(e,this.pos)}}};function W(t,e){for(;e<t.length;e++){let r=t.charCodeAt(e);if(r==10)break;if(!A(r))return-1}return e}var oe=class{nextLine(e,r,n){let s=r.depth<e.stack.length?-1:$e(r),i=r.next;if(s<0)return!1;let o=g(u.HeaderMark,e.lineStart+r.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(n,g(i==61?u.SetextHeading1:u.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},qe={LinkReference(t,e){return e.content.charCodeAt(0)==91?new ie(e):null},SetextHeading(){return new oe}},Ct=[(t,e)=>Xe(e)>=0,(t,e)=>Te(e)>=0,(t,e)=>De(e)>=0,(t,e)=>pe(e,t,!0)>=0,(t,e)=>ce(e,t,!0)>=0,(t,e)=>de(e,t,!0)>=0,(t,e)=>_e(e,t,!0)>=0],At={text:"",end:0},ae=class{constructor(e,r,n,s){this.parser=e,this.input=r,this.ranges=s,this.line=new re,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=s[s.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=s[0].from,this.block=Q.create(u.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new fe(n,r):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!s||e.markers[n].from<s.end);){let i=e.markers[n++];this.addNode(i.type,i.from,i.to)}if(!s)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let s=n(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let r=new te(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let s=n(this,r);s&&r.parsers.push(s)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,r))break e}for(let n of r.parsers)if(n.nextLine(this,e,r))return null;r.content+=`
|
||||
`+e.scrub();for(let n of e.markers)r.marks.push(n)}return this.finishLeaf(r),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let r=this.fragments.takeNodes(this);return r?(this.absoluteLineStart+=r,this.lineStart=Ye(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let r=At;if(r.end=e,e>=this.to)r.text="";else if(r.text=this.lineChunkAt(e),r.end+=r.text.length,this.ranges.length>1){let n=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<r.end;){s++;let i=this.ranges[s].from,o=this.lineChunkAt(i);r.end=i+o.length,r.text=r.text.slice(0,this.ranges[s-1].to-n)+o,n=r.end-r.text.length}}return r}readLine(){let{line:e}=this,{text:r,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(r);e.depth<this.stack.length;e.depth++){let s=this.stack[e.depth],i=this.parser.skipContextMarkup[s.type];if(!i)throw new Error("Unhandled block context "+u[s.type]);let o=this.line.markers.length;if(!i(s,this,e)){this.line.markers.length>o&&(s.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let r=this.input.chunk(e),n;if(this.input.lineChunks)n=r==`
|
||||
`?"":r;else{let s=r.indexOf(`
|
||||
`);n=s<0?r:r.slice(0,s)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,r,n=0){this.block=Q.create(e,n,this.lineStart+r,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,r,n=0){this.startContext(this.parser.getNodeType(e),r,n)}addNode(e,r,n){typeof e=="number"&&(e=new x(this.parser.nodeSet.types[e],y,y,(n??this.prevLineEnd())-r)),this.block.addChild(e,r-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,r){this.addNode(this.buffer.writeElements(he(r.children,e.marks),-r.from).finish(r.type,r.to-r.from),r.from)}finishContext(){let e=this.stack.pop(),r=this.stack[this.stack.length-1];r.addChild(e.toTree(this.parser.nodeSet),e.from-r.from),this.block=r}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Qe(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let r=he(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(r,-e.start).finish(u.Paragraph,e.content.length),e.start)}elt(e,r,n,s){return typeof e=="string"?g(this.parser.getNodeType(e),r,n,s):new G(e,r)}get buffer(){return new Z(this.parser.nodeSet)}};function Qe(t,e,r,n,s){let i=t[e].to,o=[],a=[],l=r.from+n;function h(f,p){for(;p?f>=i:f>i;){let d=t[e+1].from-i;n+=d,f+=d,e++,i=t[e].to}}for(let f=r.firstChild;f;f=f.nextSibling){h(f.from+n,!0);let p=f.from+n,d,c=s.get(f.tree);c?d=c:f.to+n>i?(d=Qe(t,e,f,n,s),h(f.to+n,!1)):d=f.toTree(),o.push(d),a.push(p-l)}return h(r.to+n,!1),new x(r.type,o,a,r.to+n-l,r.tree?r.tree.propValues:void 0)}var F=class t extends bt{constructor(e,r,n,s,i,o,a,l,h){super(),this.nodeSet=e,this.blockParsers=r,this.leafBlockParsers=n,this.blockNames=s,this.endLeafBlock=i,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=h,this.nodeTypes=Object.create(null);for(let f of e.types)this.nodeTypes[f.name]=f.id}createParse(e,r,n){let s=new ae(this,e,r,n);for(let i of this.wrappers)s=i(s,e,r,n);return s}configure(e){let r=le(e);if(!r)return this;let{nodeSet:n,skipContextMarkup:s}=this,i=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),h=this.inlineNames.slice(),f=this.endLeafBlock.slice(),p=this.wrappers;if(z(r.defineNodes)){s=Object.assign({},s);let d=n.types.slice(),c;for(let L of r.defineNodes){let{name:k,block:E,composite:w,style:S}=typeof L=="string"?{name:L}:L;if(d.some(M=>M.name==k))continue;w&&(s[d.length]=(M,O,Lt)=>w(O,Lt,M.value));let b=d.length,B=w?["Block","BlockContext"]:E?b>=u.ATXHeading1&&b<=u.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;d.push(J.define({id:b,name:k,props:B&&[[D.group,B]]})),S&&(c||(c={}),Array.isArray(S)||S instanceof St?c[k]=S:Object.assign(c,S))}n=new Oe(d),c&&(n=n.extend(ze(c)))}if(z(r.props)&&(n=n.extend(...r.props)),z(r.remove))for(let d of r.remove){let c=this.blockNames.indexOf(d),L=this.inlineNames.indexOf(d);c>-1&&(i[c]=o[c]=void 0),L>-1&&(l[L]=void 0)}if(z(r.parseBlock))for(let d of r.parseBlock){let c=a.indexOf(d.name);if(c>-1)i[c]=d.parse,o[c]=d.leaf;else{let L=d.before?q(a,d.before):d.after?q(a,d.after)+1:a.length-1;i.splice(L,0,d.parse),o.splice(L,0,d.leaf),a.splice(L,0,d.name)}d.endLeaf&&f.push(d.endLeaf)}if(z(r.parseInline))for(let d of r.parseInline){let c=h.indexOf(d.name);if(c>-1)l[c]=d.parse;else{let L=d.before?q(h,d.before):d.after?q(h,d.after)+1:h.length-1;l.splice(L,0,d.parse),h.splice(L,0,d.name)}}return r.wrap&&(p=p.concat(r.wrap)),new t(n,i,o,a,f,s,l,h,p)}getNodeType(e){let r=this.nodeTypes[e];if(r==null)throw new RangeError(`Unknown node type '${e}'`);return r}parseInline(e,r){let n=new P(this,e,r);e:for(let s=r;s<n.end;){let i=n.char(s);for(let o of this.inlineParsers)if(o){let a=o(n,i,s);if(a>=0){s=a;continue e}}s++}return n.resolveMarkers(0)}};function z(t){return t!=null&&t.length>0}function le(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=le(t[0]);if(t.length==1)return e;let r=le(t.slice(1));if(!r||!e)return e||r;let n=(o,a)=>(o||y).concat(a||y),s=e.wrap,i=r.wrap;return{props:n(e.props,r.props),defineNodes:n(e.defineNodes,r.defineNodes),parseBlock:n(e.parseBlock,r.parseBlock),parseInline:n(e.parseInline,r.parseInline),remove:n(e.remove,r.remove),wrap:s?i?(o,a,l,h)=>s(i(o,a,l,h),a,l,h):s:i}}function q(t,e){let r=t.indexOf(e);if(r<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return r}var Ze=[J.none];for(let t=1,e;e=u[t];t++)Ze[t]=J.define({id:t,name:e,props:t>=u.Escape?[]:[[D.group,t in Re?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var y=[],Z=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,r,n,s=0){return this.content.push(e,r,n
Line truncated
|
||||
`;)i--;this.fragmentEnd=i?i-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(Ce.IncludeAnonymous|Ce.IgnoreMounts),n.firstChild());let s=e+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=r;if(!n.childAfter(s))return!1}}matches(e){let r=this.cursor.tree;for(;r&&r.type.isAnonymous&&r.children[0]instanceof x;)r=r.children[0];return r&&r.prop(D.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=e.lineStart-e.block.from>>2,h=o,f=a;e:for(;;){if(r.to-n>Math.min(s,e.to)||r.type.isAnonymous&&r.tree&&(r.to-r.from>l||!It(r.tree))){if(r.type.isAnonymous&&r.firstChild())continue;break}let p=Ye(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,p);else{let d=new x(e.parser.nodeSet.types[u.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(d,r.tree),e.addNode(d,p)}for((r.type.isAnonymous||r.type.is("Block"))&&(r.type.isAnonymous||Je.indexOf(r.type.id)<0?(o=r.to-n,a=e.block.children.length):(o=h,a=f),h=r.to-n,f=e.block.children.length);;){if(r.nextSibling())continue e;if(!r.parent()||!r.type.isAnonymous)break e}}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}};function It(t){for(;t.type.isAnonymous;){let e=t.children[t.children.length-1];if(e instanceof x)t=e;else return!1}return t.type.is("Block")&&Je.indexOf(t.type.id)<0}function Ye(t,e){let r=t;for(let n=1;n<e.length;n++){let s=e[n-1].to,i=e[n].from;s<t&&(r-=i-s)}return r}var Et=ze({"Blockquote/...":m.quote,HorizontalRule:m.contentSeparator,"ATXHeading1/... SetextHeading1/...":m.heading1,"ATXHeading2/... SetextHeading2/...":m.heading2,"ATXHeading3/...":m.heading3,"ATXHeading4/...":m.heading4,"ATXHeading5/...":m.heading5,"ATXHeading6/...":m.heading6,"Comment CommentBlock":m.comment,Escape:m.escape,Entity:m.character,"Emphasis/...":m.emphasis,"StrongEmphasis/...":m.strong,"Link/... Image/...":m.link,"OrderedList/... BulletList/...":m.list,"BlockQuote/...":m.quote,"InlineCode CodeText":m.monospace,"URL Autolink":m.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":m.processingInstruction,"CodeInfo LinkLabel":m.labelName,LinkTitle:m.string,Paragraph:m.content}),We=new F(new Oe(Ze).extend(Et),Object.keys(_).map(t=>_[t]),Object.keys(_).map(t=>qe[t]),Object.keys(_),Ct,Re,Object.keys(ee).map(t=>ee[t]),Object.keys(ee),[]);function Bt(t,e,r){let n=[];for(let s=t.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:r;if(o>i&&n.push({from:i,to:o}),!s)break;i=s.to}return n}function et(t){let{codeParser:e,htmlParser:r}=t;return{wrap:wt((s,i)=>{let o=s.type.id;if(e&&(o==u.CodeBlock||o==u.FencedCode)){let a="";if(o==u.FencedCode){let h=s.node.getChild(u.CodeInfo);h&&(a=i.read(h.from,h.to))}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==u.CodeText,bracketed:o==u.FencedCode}}else if(r&&(o==u.HTMLBlock||o==u.HTMLTag||o==u.CommentBlock))return{parser:r,overlay:Bt(s.node,s.from,s.to)};return null})}}var Mt={resolve:"Strikethrough",mark:"StrikethroughMark"},Ht={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":m.strikethrough}},{name:"StrikethroughMark",style:m.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),s=t.slice(r+2,r+3),i=/\s|^$/.test(n),o=/\s|^$/.test(s),a=X.test(n),l=X.test(s);return t.addDelimiter(Mt,r,r+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function T(t,e,r=0,n,s=0){let i=0,o=!0,a=-1,l=-1,h=!1,f=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let p=r;p<e.length;p++){let d=e.charCodeAt(p);d==124&&!h?((!o||a>-1)&&i++,o=!1,n&&(a>-1&&f(),n.push(t.elt("TableDelimiter",p+s,p+s+1))),a=l=-1):(h||d!=32&&d!=9)&&(a<0&&(a=p),l=p+1),h=!h&&d==92}return a>-1&&(i++,n&&f()),i}function Be(t,e){for(let r=e;r<t.length;r++){let n=t.charCodeAt(r);if(n==124)return!0;n==92&&r++}return!1}var tt=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,K=class{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let s;if((r.next==45||r.next==58||r.next==124)&&tt.test(s=r.text.slice(r.pos))){let i=[];T(e,n.content,0,i,n.start)==T(e,s,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,i),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let s=[];T(e,r.text,r.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,s))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}},vt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":m.heading}},"TableRow",{name:"TableCell",style:m.content},{name:"TableDelimiter",style:m.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Be(e.content,0)?new K:null},endLeaf(t,e,r){if(r.parsers.some(s=>s instanc
Line truncated
|
||||
//# sourceMappingURL=lang-markdown.bundle.mjs.map
|
||||
Reference in new issue
Block a user