const customRenderer = new marked.Renderer(); customRenderer.heading = function(text, level) { return `${text}`; }; customRenderer.paragraph = function(text) { text = text.replace(/\[Copy\]([\s\S]*?)\[\/Copy\]/g, '$1'); return `
${text}
`; }; // 重写渲染器的link方法,根据链接内容进行自定义渲染 customRenderer.link = function(href, title, text) { // LinkButton: 开头的链接 if (href.startsWith("LinkButton:")) { const link = href.substring(11); return `${text}`; } // LocalButton: 开头的链接 if (href.startsWith("LocalButton:")) { const link = href.substring(12); return `${text}`; } // Button: 开头的链接 else if (href.startsWith("Button:")) { const f = href.substring(7); return ``; } // InPage: 开头的链接 else if (href.startsWith("InPage:")) { const link = href.substring(7); return ``; } // 其他情况下的一般链接 else { return `${text}`; } }; customRenderer.image = function(href, title, text) { return `${text}`; }; customRenderer.blockquote = function(quote) { return `
${quote}
`; }; customRenderer.code = function(code, language, isEscaped) { return `
${code}
`; }; customRenderer.hr = function() { return `
`; }; customRenderer.table = function(header, body) { return ` ${header}${body}
`; };