From 62f24a177482079e30f1ccaef9931d0fb9035ffd Mon Sep 17 00:00:00 2001
From: CyC2018
Date: Fri, 6 Nov 2026 06:18:35 +0800
Subject: [PATCH 1/6] Add marked.min.js
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
marked 1.2.9(与 Docsify 4.13.1 依赖的版本相同),构建笔记的静态页面时渲染 Markdown。
---
website/builder/vendor/marked.min.js | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 website/builder/vendor/marked.min.js
diff --git a/website/builder/vendor/marked.min.js b/website/builder/vendor/marked.min.js
new file mode 100644
index 00000000..10e78525
--- /dev/null
+++ b/website/builder/vendor/marked.min.js
@@ -0,0 +1,6 @@
+/**
+ * marked - a markdown parser
+ * Copyright (c) 2011-2021, Christopher Jeffrey. (MIT Licensed)
+ * https://github.com/markedjs/marked
+ */
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).marked=t()}(this,function(){"use strict";function i(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e){return c[e]}var e,t=(function(t){function e(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}t.exports={defaults:e(),getDefaults:e,changeDefaults:function(e){t.exports.defaults=e}}}(e={exports:{}}),e.exports),r=/[&<>"']/,l=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,c={"&":"&","<":"<",">":">",'"':""","'":"'"};var u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(e){return e.replace(u,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}var g=/(^|[^\[])\^/g;var f=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var k={},b=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,x=/^([^:]+:\/*[^/]*)[\s\S]*$/;function w(e,t){k[" "+e]||(b.test(e)?k[" "+e]=e+"/":k[" "+e]=v(e,"/",!0));var n=-1===(e=k[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(x,"$1")+t:e+t}function v(e,t,n){var r=e.length;if(0===r)return"";for(var i=0;it)n.splice(t);else for(;n.length>=1,e+=e;return n+e},q=t.defaults,O=v,C=R,U=_,j=T;function E(e,t,n){var r=t.href,i=t.title?U(t.title):null,t=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:r,title:i,text:t}:{type:"image",raw:n,href:r,title:i,text:U(t)}}var P=function(){function e(e){this.options=e||q}var t=e.prototype;return t.space=function(e){e=this.rules.block.newline.exec(e);if(e)return 1=n.length?e.slice(n.length):e}).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]&&t[2].trim(),text:e}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var n=t[2].trim();return/#$/.test(n)&&(e=O(n,"#"),!this.options.pedantic&&e&&!/ $/.test(e)||(n=e.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:n}}},t.nptable=function(e){e=this.rules.block.nptable.exec(e);if(e){var t={type:"table",header:C(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(t.header.length===t.align.length){for(var n=t.align.length,r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:e}}},t.list=function(e){e=this.rules.block.list.exec(e);if(e){for(var t,n,r,i,s,l=e[0],a=e[2],o=1g[1].length:r[1].length>g[0].length||3/i.test(e[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):U(e[0]):e[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=t[2].trim();if(!this.options.pedantic&&/^$/.test(n))return;e=O(n.slice(0,-1),"\\");if((n.length-e.length)%2==0)return}else{var r=j(t[2],"()");-1$/.test(n)?r.slice(1):r.slice(1,-1):r)&&r.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},t[0])}},t.reflink=function(e,t){if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){e=(n[2]||n[1]).replace(/\s+/g," ");if((e=t[e.toLowerCase()])&&e.href)return E(n,e,n[0]);var n=n[0].charAt(0);return{type:"text",raw:n,text:n}}},t.strong=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var i,s="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(i=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,i[0].length),text:e.slice(2,i[0].length-2)}}},t.em=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var i,s="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(i=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,i[0].length),text:e.slice(1,i[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),e=/^ /.test(n)&&/ $/.test(n);return r&&e&&(n=n.substring(1,n.length-1)),n=U(n,!0),{type:"codespan",raw:t[0],text:n}}},t.br=function(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}},t.del=function(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2]}},t.autolink=function(e,t){e=this.rules.inline.autolink.exec(e);if(e){var n,t="@"===e[2]?"mailto:"+(n=U(this.options.mangle?t(e[1]):e[1])):n=U(e[1]);return{type:"link",raw:e[0],text:n,href:t,tokens:[{type:"text",raw:n,text:n}]}}},t.url=function(e,t){var n,r,i,s;if(n=this.rules.inline.url.exec(e)){if("@"===n[2])i="mailto:"+(r=U(this.options.mangle?t(n[0]):n[0]));else{for(;s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0],s!==n[0];);r=U(n[0]),i="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,n){e=this.rules.inline.text.exec(e);if(e){n=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):U(e[0]):e[0]:U(this.options.smartypants?n(e[0]):e[0]);return{type:"text",raw:e[0],text:n}}},e}(),R=S,T=z,S=A,z={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:R,table:R,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};z.def=T(z.def).replace("label",z._label).replace("title",z._title).getRegex(),z.bullet=/(?:[*+-]|\d{1,9}[.)])/,z.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,z.item=T(z.item,"gm").replace(/bull/g,z.bullet).getRegex(),z.listItemStart=T(/^( *)(bull)/).replace("bull",z.bullet).getRegex(),z.list=T(z.list).replace(/bull/g,z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+z.def.source+")").getRegex(),z._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",z._comment=/|$)/,z.html=T(z.html,"i").replace("comment",z._comment).replace("tag",z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),z.paragraph=T(z._paragraph).replace("hr",z.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",z._tag).getRegex(),z.blockquote=T(z.blockquote).replace("paragraph",z.paragraph).getRegex(),z.normal=S({},z),z.gfm=S({},z.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),z.gfm.nptable=T(z.gfm.nptable).replace("hr",z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",z._tag).getRegex(),z.gfm.table=T(z.gfm.table).replace("hr",z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",z._tag).getRegex(),z.pedantic=S({},z.normal,{html:T("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",z._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:R,paragraph:T(z.normal._paragraph).replace("hr",z.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});R={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:R,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:R,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};R.punctuation=T(R.punctuation).replace(/punctuation/g,R._punctuation).getRegex(),R._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",R._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",R._comment=T(z._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),R.em.start=T(R.em.start).replace(/punctuation/g,R._punctuation).getRegex(),R.em.middle=T(R.em.middle).replace(/punctuation/g,R._punctuation).replace(/overlapSkip/g,R._overlapSkip).getRegex(),R.em.endAst=T(R.em.endAst,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.em.endUnd=T(R.em.endUnd,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.strong.start=T(R.strong.start).replace(/punctuation/g,R._punctuation).getRegex(),R.strong.middle=T(R.strong.middle).replace(/punctuation/g,R._punctuation).replace(/overlapSkip/g,R._overlapSkip).getRegex(),R.strong.endAst=T(R.strong.endAst,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.strong.endUnd=T(R.strong.endUnd,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.blockSkip=T(R._blockSkip,"g").getRegex(),R.overlapSkip=T(R._overlapSkip,"g").getRegex(),R._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,R._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,R._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,R.autolink=T(R.autolink).replace("scheme",R._scheme).replace("email",R._email).getRegex(),R._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,R.tag=T(R.tag).replace("comment",R._comment).replace("attribute",R._attribute).getRegex(),R._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,R._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,R._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,R.link=T(R.link).replace("label",R._label).replace("href",R._href).replace("title",R._title).getRegex(),R.reflink=T(R.reflink).replace("label",R._label).getRegex(),R.reflinkSearch=T(R.reflinkSearch,"g").replace("reflink",R.reflink).replace("nolink",R.nolink).getRegex(),R.normal=S({},R),R.pedantic=S({},R.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:T(/^!?\[(label)\]\((.*?)\)/).replace("label",R._label).getRegex(),reflink:T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",R._label).getRegex()}),R.gfm=S({},R.normal,{escape:T(R.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\'+(n?e:H(e,!0))+"\n":""+(n?e:H(e,!0))+"
\n"},t.blockquote=function(e){return"\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,n,r){return this.options.headerIds?"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"},t.listitem=function(e){return""+e+"\n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return""+e+"
\n"},t.table=function(e,t){return"\n\n"+e+"\n"+(t=t&&""+t+"")+"
\n"},t.tablerow=function(e){return"\n"+e+"
\n"},t.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
":"
"},t.del=function(e){return""+e+""},t.link=function(e,t,n){if(null===(e=V(this.options.sanitize,this.options.baseUrl,e)))return n;e='"+n+""},t.image=function(e,t,n){if(null===(e=V(this.options.sanitize,this.options.baseUrl,e)))return n;n='
":">"},t.text=function(e){return e},e}(),K=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,n){return""+n},t.image=function(e,t,n){return""+n},t.br=function(){return""},e}(),Q=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var n=e,r=0;if(this.seen.hasOwnProperty(n))for(r=this.seen[e];n=e+"-"+ ++r,this.seen.hasOwnProperty(n););return t||(this.seen[e]=r,this.seen[n]=0),n},t.slug=function(e,t){void 0===t&&(t={});var n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)},e}(),W=t.defaults,Y=y,ee=function(){function n(e){this.options=e||W,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new K,this.slugger=new Q}n.parse=function(e,t){return new n(t).parse(e)},n.parseInline=function(e,t){return new n(t).parseInline(e)};var e=n.prototype;return e.parse=function(e,t){void 0===t&&(t=!0);for(var n,r,i,s,l,a,o,c,u,p,h,g,f,d,k,b="",m=e.length,x=0;xAn error occurred:
"+re(e.message+"",!0)+"
";throw e}}return se.options=se.setOptions=function(e){return te(se.defaults,e),ie(se.defaults),se},se.getDefaults=_,se.defaults=t,se.use=function(a){var t,n=te({},a);a.renderer&&function(){var e,l=se.defaults.renderer||new J;for(e in a.renderer)!function(i){var s=l[i];l[i]=function(){for(var e=arguments.length,t=new Array(e),n=0;nAn error occurred:"+re(e.message+"",!0)+"
";throw e}},se.Parser=ee,se.parser=ee.parse,se.Renderer=J,se.TextRenderer=K,se.Lexer=X,se.lexer=X.lex,se.Tokenizer=P,se.Slugger=Q,se.parse=se});
\ No newline at end of file
From 9be5dbc70240476285121877bf40889af68fd2f2 Mon Sep 17 00:00:00 2001
From: CyC2018
Date: Fri, 6 Nov 2026 06:18:35 +0800
Subject: [PATCH 2/6] Add marked-LICENSE.md
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
marked 的许可证。
---
website/builder/vendor/marked-LICENSE.md | 44 ++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 website/builder/vendor/marked-LICENSE.md
diff --git a/website/builder/vendor/marked-LICENSE.md b/website/builder/vendor/marked-LICENSE.md
new file mode 100644
index 00000000..4bd2d4a0
--- /dev/null
+++ b/website/builder/vendor/marked-LICENSE.md
@@ -0,0 +1,44 @@
+# License information
+
+## Contribution License Agreement
+
+If you contribute code to this project, you are implicitly allowing your code
+to be distributed under the MIT license. You are also implicitly verifying that
+all code is your original work. ``
+
+## Marked
+
+Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
+Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+## Markdown
+
+Copyright © 2004, John Gruber
+http://daringfireball.net/
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
From 85dbcbb8dc8f1843ca8122c5ae6e5bcf7b11015b Mon Sep 17 00:00:00 2001
From: CyC2018
Date: Fri, 6 Nov 2026 06:18:35 +0800
Subject: [PATCH 3/6] Add static_notes.cjs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
每篇笔记生成一个没有脚本的静态页面:标题 id 与网站一致,站内链接指向其它笔记的静态页面,文首目录折叠,配图有说明,页面上有回到阅读器的链接。
---
website/builder/static_notes.cjs | 165 +++++++++++++++++++++++++++++++
1 file changed, 165 insertions(+)
create mode 100644 website/builder/static_notes.cjs
diff --git a/website/builder/static_notes.cjs b/website/builder/static_notes.cjs
new file mode 100644
index 00000000..0aae59a4
--- /dev/null
+++ b/website/builder/static_notes.cjs
@@ -0,0 +1,165 @@
+// 每篇笔记生成一个静态页面(notes/<名字>.html):网站本身用 # 之后的地址,搜索引擎只收录得到首页;
+// 静态页面是渲染好的正文,没有脚本,搜索进来的读者直接能读,页面上有回到阅读器(目录、搜索、深色模式、面试题练习)的链接。
+// 用法:node static_notes.cjs <站点地址>,输出生成的页面数;Markdown 用和 Docsify 4.13.1 同一个大版本的 marked 渲染,
+// 标题的 id 按 Docsify 的规则生成(与 site_assets.py 的 heading_slug 相同),网站上的小节链接在静态页面上同样可用。
+'use strict';
+const fs = require('fs');
+const path = require('path');
+const marked = require('./vendor/marked.min.js');
+
+const PUNCTUATION = /[\u2000-\u206f\u2e00-\u2e7f\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g;
+function slugger() {
+ const counts = {};
+ return function (html) {
+ let slug = html.replace(/<[^>]+>/g, '').trim().toLowerCase().replace(PUNCTUATION, '');
+ slug = slug.replace(/\s/g, '-').replace(/-+/g, '-').replace(/^(\d)/, '_$1');
+ const count = counts[slug] || 0;
+ counts[slug] = count + 1;
+ return slug + (count ? '-' + count : '');
+ };
+}
+function escapeHtml(text) {
+ return String(text).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
+}
+function plain(html) {
+ return html.replace(/<[^>]+>/g, '').replace(/ /g, ' ').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
+ .replace(/"/g, '"').replace(/'/g, "'").replace(/\s+/g, ' ').trim();
+}
+const route = name => name.split('/').map(encodeURIComponent).join('/');
+
+// 一级标题后面只有页内链接的列表是文首目录,折叠起来,和网站上一样
+function foldToc(html) {
+ const head = html.match(/<\/h1>\s*/);
+ if (!head) return html;
+ const start = head.index + head[0].length - 4;
+ let depth = 0, i = start, end = -1;
+ const tag = /<(\/?)ul>/g;
+ tag.lastIndex = start;
+ for (let m; (m = tag.exec(html));) {
+ depth += m[1] ? -1 : 1;
+ if (!depth) { end = m.index + 5; break; }
+ }
+ if (end < 0) return html;
+ const list = html.slice(start, end), links = list.match(/ a.startsWith('本文目录\n' + list + '' + html.slice(end);
+}
+function render(markdown, name) {
+ const slug = slugger();
+ const renderer = new marked.Renderer();
+ renderer.heading = (text, level) => `${text}\n`;
+ // 站内笔记的链接(/notes/X.md#小节)改为静态页面;其它链接不变,外链在新窗口打开
+ renderer.link = (href, title, text) => {
+ let url = href || '';
+ const note = url.match(/^\/notes\/([^#?]+)\.md(#.*)?$/);
+ if (note) url = '/notes/' + note[1] + '.html' + (note[2] || '');
+ const external = /^https?:\/\//.test(url) && !url.startsWith('https://cyc2018.xyz/');
+ return `${text}`;
+ };
+ let html = marked(markdown.replace(//g, ''), { renderer, headerIds: false, mangle: false });
+ // 正文中直接写的 HTML 链接()同样改为静态页面
+ html = html.replace(/(]*?\bhref=")\/notes\/([^"#?]+)\.md(#[^"]*)?"/g, (m, a, n, h) => `${a}/notes/${n}.html${h || ''}"`);
+ // 配图按出现顺序,第一张直接加载,其余延迟加载;没写说明的用所在小节的标题作说明(和网站上一样)
+ let first = true, heading = '';
+ html = html.replace(/]*>([\s\S]*?)<\/h[1-6]>|
]*)>/g, (tag, title, attrs) => {
+ if (title !== undefined) { heading = plain(title); return tag; }
+ let out = '
';
+ });
+ // 能横向滚动的代码块和表格要能用键盘聚焦后滚动
+ html = html.replace(/<(pre|table)>/g, '<$1 tabindex="0">');
+ html = foldToc(html);
+ const h1 = html.match(/]*>([\s\S]*?)<\/h1>/);
+ const title = h1 ? plain(h1[1]) : name.split('/').pop();
+ const para = html.match(/
([\s\S]*?)<\/p>/);
+ return { html, title, description: para ? plain(para[1]).slice(0, 120) : title };
+}
+
+const STYLE = `
+:root { color-scheme: light dark; --bg: #f3f2ee; --surface: #fafbf8; --text: #34495e; --heading: #2c3e50; --muted: #5f6d66; --border: #dfe3da; --theme: #2a7a5a; --soft: #e7f1eb; --code: #9a3f2a; }
+@media (prefers-color-scheme: dark) { :root { --bg: #1a1d1c; --surface: #1f2422; --text: #c9d1cc; --heading: #e6ebe7; --muted: #98a59d; --border: #2f3633; --theme: #5cbf92; --soft: #23312b; --code: #e7a28f; } img { filter: brightness(.9); background: #ecebe6; } }
+* { box-sizing: border-box; }
+body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.95 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-text-size-adjust: 100%; }
+a { color: var(--theme); text-underline-offset: 3px; }
+.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
+.top .brand { color: var(--heading); font-weight: 700; text-decoration: none; }
+.open { display: inline-block; padding: 4px 12px; border: 1px solid var(--theme); border-radius: 6px; font-size: 14px; text-decoration: none; }
+main { max-width: 900px; margin: 0 auto; padding: 28px 24px 64px; }
+h1, h2, h3, h4, h5, h6 { color: var(--heading); line-height: 1.4; scroll-margin-top: 64px; }
+h1 { font-size: 2rem; margin: .4em 0 1em; }
+h2 { margin-top: 2.6rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
+img { max-width: 100%; height: auto; border-radius: 4px; }
+pre { overflow: auto; padding: 14px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); line-height: 1.65; }
+code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .88em; }
+:not(pre) > code { color: var(--code); overflow-wrap: anywhere; }
+table { display: block; overflow: auto; border-collapse: collapse; }
+pre:focus-visible, table:focus-visible { outline: 2px solid var(--theme); outline-offset: 2px; }
+td, th { padding: 6px 12px; border: 1px solid var(--border); }
+blockquote { margin: 1em 0; padding: 2px 16px; border-left: 4px solid var(--theme); background: var(--soft); }
+.toc { margin: 0 0 28px; padding: 6px 18px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }.toc summary { color: var(--theme); font-weight: 600; cursor: pointer; padding: 6px 0; }.toc a { text-decoration: none; }.toc ul { margin: 4px 0; line-height: 1.75; }
+.hot-1::after { content: " 🔥"; } .hot-2::after { content: " 🔥🔥"; }
+.reader { margin: 40px 0 0; padding: 14px 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 15px; }
+footer { padding: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; }
+footer a { color: inherit; }
+@media (max-width: 640px) { main { padding: 20px 18px 48px; } h1 { font-size: 1.6rem; } .top { padding: 8px 14px; } }
+@media print { .top, .reader, footer { display: none; } body { background: #fff; } }
+`.replace(/\n\s*/g, '');
+
+function page({ html, title, description }, name, site, stub) {
+ const url = site + 'notes/' + route(name) + '.html';
+ const reader = '/#/notes/' + route(name);
+ const canonical = stub ? site + 'notes/' + route(stub) + '.html' : url;
+ return `
+
+
+
+
+ ${escapeHtml(title)} · CS-Notes
+
+
+${stub ? ` \n` : ''}
+
+
+
+
+
+
+
+
+
+
+
+
+
+${html}
+
+ 在阅读器中可以用目录和搜索、切换深色模式、练习这篇笔记中的面试题:打开《${escapeHtml(title)}》
+
+
+
+
+`;
+}
+
+function build(dist, site, stubs) {
+ const dir = path.join(dist, 'notes');
+ const names = fs.readdirSync(dir).filter(f => f.endsWith('.md')).map(f => f.slice(0, -3)).sort();
+ const urls = [];
+ for (const name of names) {
+ const stub = stubs['/notes/' + name] && stubs['/notes/' + name].replace(/^\/notes\//, '');
+ const rendered = render(fs.readFileSync(path.join(dir, name + '.md'), 'utf8'), name);
+ fs.writeFileSync(path.join(dir, name + '.html'), page(rendered, name, site, stub));
+ if (!stub) urls.push(site + 'notes/' + route(name) + '.html');
+ }
+ return urls;
+}
+
+module.exports = { render, slugger, build };
+
+if (require.main === module) {
+ const [dist, site, stubsFile] = process.argv.slice(2);
+ const stubs = stubsFile ? JSON.parse(fs.readFileSync(stubsFile, 'utf8')) : {};
+ process.stdout.write(JSON.stringify(build(dist, site, stubs)));
+}
From 17b2838357044747d4b32d0ec74a64d8ec3bf522 Mon Sep 17 00:00:00 2001
From: CyC2018
Date: Fri, 6 Nov 2026 06:18:35 +0800
Subject: [PATCH 4/6] Update build.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
构建时生成笔记的静态页面和站点地图,robots.txt 指向站点地图。
---
website/builder/build.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/website/builder/build.py b/website/builder/build.py
index 5a25d8ea..aa34cee7 100644
--- a/website/builder/build.py
+++ b/website/builder/build.py
@@ -298,7 +298,7 @@ def build(optimize=True):
(dist / '_404.md').write_text('# 页面暂未找到\n\n请从目录或搜索查找笔记。\n\n[返回首页](/)\n')
(dist / '.nojekyll').touch()
# 允许收录;学习站每道题的页面列在它的站点地图中(笔记页面在 # 之后,没有单独的地址)
- (dist / 'robots.txt').write_text('User-agent: *\nAllow: /\n' + (f'Sitemap: {SITE_URL}learn/sitemap.xml\n' if LEARN_BUILD.is_file() else ''))
+ (dist / 'robots.txt').write_text('User-agent: *\nAllow: /\n' + f'Sitemap: {SITE_URL}sitemap.xml\n' + (f'Sitemap: {SITE_URL}learn/sitemap.xml\n' if LEARN_BUILD.is_file() else ''))
shutil.copyfile(ROOT / 'docs/_media/LogoMakr_1J56bI.png', dist / 'favicon.png')
write_app_icons(dist, ROOT / 'docs/_media/LogoMakr_1J56bI.png')
learn_report = None
@@ -333,6 +333,14 @@ def build(optimize=True):
image_report['sized'] = add_image_sizes(dist)
index_name, search_report = write_search_index(dist, sorted((dist / 'notes').glob('*.md')))
animations = write_animations(dist)
+ # 每篇笔记的静态页面(notes/<名字>.html,搜索引擎收录用)和站点地图;配图已经换成优化后的地址、补上高度
+ stubs_file = CACHE / 'stubs.json'
+ stubs_file.parent.mkdir(parents=True, exist_ok=True)
+ stubs_file.write_text(json.dumps(stubs, ensure_ascii=False))
+ static_urls = json.loads(subprocess.run(['node', str(Path(__file__).parent / 'static_notes.cjs'), str(dist), SITE_URL, str(stubs_file)],
+ check=True, capture_output=True, text=True).stdout)
+ (dist / 'sitemap.xml').write_text('\n\n' +
+ ''.join(f' {html.escape(url)}\n' for url in [SITE_URL] + static_urls) + '\n')
legacy = json.loads((SITE / 'legacy-routes.json').read_text())
(dist / 'search-paths.js').write_text(
'window.CS_NOTES_PATHS = ' + json.dumps(note_paths, ensure_ascii=False) + ';\n'
@@ -345,12 +353,12 @@ def build(optimize=True):
'window.CS_NOTES_LEARN_SECTIONS = ' + json.dumps(learn_sections, ensure_ascii=False, separators=(',', ':')) + ';\n')
generator = hashlib.sha256()
learn = [*LEARN_BUILD.parent.glob('*.py'), *(LEARN_BUILD.parent / 'src').rglob('*')] if LEARN_BUILD.is_file() else []
- for resource in sorted([*Path(__file__).parent.glob('*.py'), *SITE.rglob('*'), *learn]):
+ for resource in sorted([*Path(__file__).parent.glob('*.py'), *Path(__file__).parent.glob('*.cjs'), *(Path(__file__).parent / 'vendor').rglob('*'), *SITE.rglob('*'), *learn]):
if resource.is_file():
generator.update(resource.relative_to(BASE.parent).as_posix().encode())
generator.update(resource.read_bytes())
build_info = {'sourceCommit': SOURCE_COMMIT, 'generatorHash': generator.hexdigest(), 'notes': len(note_paths),
- 'searchIndex': index_name, 'legacyRoutes': len(legacy)}
+ 'searchIndex': index_name, 'legacyRoutes': len(legacy), 'staticPages': len(static_urls)}
(dist / 'build-info.json').write_text(json.dumps(build_info, indent=2) + '\n')
# 网站读取的是同内容的 .txt:EdgeOne 只压缩 text/plain 等类型,.md 的 text/markdown 不压缩
for document in list(dist.rglob('*.md')):
From ffb5d970e35bcfaabcc7aec5fc665ca468b809a3 Mon Sep 17 00:00:00 2001
From: CyC2018
Date: Fri, 6 Nov 2026 06:18:35 +0800
Subject: [PATCH 5/6] Update test_site_assets.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
补充静态页面的标题 id、链接、目录和旧页面跳转的测试。
---
website/builder/test_site_assets.py | 32 +++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/website/builder/test_site_assets.py b/website/builder/test_site_assets.py
index 4ad405d8..33fef84e 100644
--- a/website/builder/test_site_assets.py
+++ b/website/builder/test_site_assets.py
@@ -1,4 +1,6 @@
"""Regression checks for generated search anchors and asset collection."""
+import re
+import json
import sys
import tempfile
import unittest
@@ -84,5 +86,35 @@ class SearchIndexTests(unittest.TestCase):
'```html\n
\n```\n')
+ def test_static_note_pages(self):
+ # 静态页面的标题 id 与网站(Docsify)一致,站内链接换成静态页面,文首目录折叠,只剩一个链接的旧页面跳到目标
+ import collections, subprocess
+ with tempfile.TemporaryDirectory() as directory:
+ dist = Path(directory)
+ (dist / 'notes').mkdir()
+ titles = ['示例', '1. 爬楼梯', 'HashMap 的 `put()`', '"引号"', '示例', 'A1 实测']
+ toc = '\n'.join(f'* [{t}](#x{i})' for i, t in enumerate(titles))
+ body = f'# {titles[0]}\n\n{toc}\n\n\n正文第一段,见 [另一篇](/notes/%E5%8F%A6.md#_1-%E7%88%AC%E6%A5%BC%E6%A2%AF)。\n\n' + \
+ ''.join(f'## {t}\n\n内容\n\n' for t in titles[1:]) + 'HTML 链接\n\n```java\n# 不是标题\n```\n'
+ (dist / 'notes' / '示例.md').write_text(body)
+ (dist / 'notes' / '算法.md').write_text('见 [算法 - 目录](/notes/算法 - 目录.md)\n')
+ (dist / 'stubs.json').write_text(json.dumps({'/notes/算法': '/notes/算法 - 目录'}, ensure_ascii=False))
+ urls = json.loads(subprocess.run(['node', str(Path(__file__).parent / 'static_notes.cjs'), str(dist), 'https://example.com/', str(dist / 'stubs.json')],
+ check=True, capture_output=True, text=True).stdout)
+ self.assertEqual(urls, ['https://example.com/notes/%E7%A4%BA%E4%BE%8B.html'])
+ page = (dist / 'notes' / '示例.html').read_text()
+ counts = collections.Counter()
+ expected = [heading_slug(t, counts) for t in titles]
+ self.assertEqual(re.findall(r'本文目录', page)
+ self.assertIn('', page)
+ self.assertIn('href="/#/notes/%E7%A4%BA%E4%BE%8B"', page)
+ self.assertNotIn('