介绍
Luma 是一个面向 Typecho 1.2+ 的零框架三栏轻量博客主题。主题包含 18 套日间配色和 6 套夜间配色,每次打开页面都会从当前模式的颜色池中随机选择。
若不显示文章内容则需要修复 theme.js,找到 highlightCode 函数里的for循环,改成
for (const match of value.matchAll(token)) {
output += escapeHtml(value.slice(cursor, match.index));
const tokenText = match[0];
const type = tokenText.startsWith('//') || tokenText.startsWith('/*') || tokenText.startsWith('<!--')
? 'comment' : tokenText.startsWith('"') || tokenText.startsWith("'")
? 'string' : /^\d/.test(tokenText) ? 'number' : 'keyword';
output += `<span class="hl-${type}">${escapeHtml(tokenText)}</span>`;
cursor = match.index + tokenText.length;
}也就是把循环内部所有表示“当前匹配文本”的 value 改成 tokenText,避免遮蔽外层参数 value。
还没有评论,快来抢沙发吧!