PageSourceSearch

https://jiangzhixiong.com/plugins/shiki/assets/static/dist-BLf-3SLI.js

js jiangzhixiong.com collected 2026-10-03 23:20:26 UTC 5,058 bytes, 1 lines download raw bytes

1var matchers=[[/^(<!--)(.+)(-->)$/,!1],[/^(\/\*)(.+)(\*\/)$/,!1],[/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/,!0],[/^(\*)(.+)$/,!0]];function parseComments(e,t,n){let i=[];for(let l of e){if("v3"===n){let e=l.children.flatMap((e,t)=>{if("element"!==e.type)return e;let n=e.children[0];if("text"!==n.type)return e;let i=t===l.children.length-1;if(!matchToken(n.value,i))return e;let r=n.value.split(/(\s+\/\/)/);if(r.length<=1)return e;let o=[r[0]];for(let e=1;e<r.length;e+=2)o.push(r[e]+(r[e+1]||""));return o=o.filter(Boolean),o.length<=1?e:o.map(t=>({...e,children:[{type:"text",value:t}]}))});e.length!==l.children.length&&(l.children=e)}let e=l.children,r=e.length-1;"v1"===n?r=0:t&&(r=e.length-2);for(let n=Math.max(r,0);n<e.length;n++){let r=e[n];if("element"!==r.type)continue;let o=r.children.at(0);if("text"!==o?.type)continue;let a=n===e.length-1,s=matchToken(o.value,a);if(!s&&n>0&&o.value.trim().startsWith("[!code")){let t=e[n-1];if("element"===t?.type){let n=t.children.at(0);if("text"===n?.type&&n.value.includes("//")){let h=matchToken(n.value+o.value,a);if(h){s=h,i.push({info:h,line:l,token:t,isLineCommentOnly:2===e.length&&1===t.children.length&&1===r.children.length,isJsxStyle:!1,additionalTokens:[r]});continue}}}}if(s)if(t&&!a&&0!==n){let t=isValue(e[n-1],"{")&&isValue(e[n+1],"}");i.push({info:s,line:l,token:r,isLineCommentOnly:3===e.length&&1===r.children.length,isJsxStyle:t,additionalTokens:void 0})}else i.push({info:s,line:l,token:r,isLineCommentOnly:1===e.length&&1===r.children.length,isJsxStyle:!1,additionalTokens:void 0})}}return i}function isValue(e,t){if("element"!==e.type)return!1;let n=e.children[0];return"text"===n.type&&n.value.trim()===t}function matchToken(e,t){let n=e.trimStart(),i=e.length-n.length;n=n.trimEnd();let l=e.length-n.length-i;for(let[e,r]of matchers){if(r&&!t)continue;let o=e.exec(n);if(o)return[" ".repeat(i)+o[1],o[2],o[3]?o[3]+" ".repeat(l):void 0]}}function v1ClearEndCommentPrefix(e){let t=e.match(/(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/);return t&&0===t[1].trim().length?e.slice(0,t.index):e}function createCommentNotationTransformer(e,t,n,i){return i??="v3",{name:e,code(e){let l=e.children.filter(e=>"element"===e.type),r=[];e.data??={};let o=e.data;o._shiki_notation??=parseComments(l,["jsx","tsx"].includes(this.options.lang),i);let a=o._shiki_notation;for(let e of a){if(0===e.info[1].length)continue;let o=l.indexOf(e.line);e.isLineCommentOnly&&"v1"!==i&&o++;let a=!1;if(e.info[1]=e.info[1].replace(t,(...t)=>n.call(this,t,e.line,e.token,l,o)?(a=!0,""):t[0]),!a)continue;"v1"===i&&(e.info[1]=v1ClearEndCommentPrefix(e.info[1]));let s=0===e.info[1].trim().length;if(s&&(e.info[1]=""),s&&e.isLineCommentOnly)r.push(e.line);else if(s&&e.isJsxStyle)e.line.children.splice(e.line.children.indexOf(e.token)-1,3);else if(s){if(e.additionalTokens)for(let t=e.additionalTokens.length-1;t>=0;t--){let n=e.additionalTokens[t],i=e.line.children.indexOf(n);-1!==i&&e.line.children.splice(i,1)}e.line.children.splice(e.line.children.indexOf(e.token),1)}else{let t=e.token.children[0];if("text"===t.type&&(t.value=e.info.join(""),e.additionalTokens))for(let t of e.additionalTokens){let e=t.children[0];"text"===e?.type&&(e.value="")}}}for(let t of r){let n=e.children.indexOf(t),i=e.children[n+1],l=1;"text"===i?.type&&"\n"===i?.value&&(l=2),e.children.splice(n,l)}}}}function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function transformerNotationMap(e={},t="@shikijs/transformers:notation-map"){let{classMap:n={},classActivePre:i}=e;return createCommentNotationTransformer(t,RegExp(`#?\\s*\\[!code (${Object.keys(n).map(escapeRegExp).join("|")})(:\\d+)?\\]`,"gi"),function([e,t,l=":1"],r,o,a,s){let h=Number.parseInt(l.slice(1),10);for(let e=s;e<Math.min(s+h,a.length);e++)this.addClassToHast(a[e],n[t]);return i&&this.addClassToHast(this.pre,i),!0},e.matchAlgorithm)}function transformerNotationDiff(e={}){let{classLineAdd:t="diff add",classLineRemove:n="diff remove",classActivePre:i="has-diff"}=e;return transformerNotationMap({classMap:{"++":t,"--":n},classActivePre:i,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-diff")}function transformerNotationErrorLevel(e={}){let{classMap:t={error:["highlighted","error"],warning:["highlighted","warning"]},classActivePre:n="has-highlighted"}=e;return transformerNotationMap({classMap:t,classActivePre:n,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-error-level")}function transformerNotationFocus(e={}){let{classActiveLine:t="focused",classActivePre:n="has-focused"}=e;
1return transformerNotationMap({classMap:{focus:t},classActivePre:n,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-focus")}function transformerNotationHighlight(e={}){let{classActiveLine:t="highlighted",classActivePre:n="has-highlighted"}=e;return transformerNotationMap({classMap:{highlight:t,hl:t},classActivePre:n,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-highlight")}export{transformerNotationDiff,transformerNotationErrorLevel,transformerNotationFocus,transformerNotationHighlight};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.