编码
7 postsGhost使用11ty时生成无插件生成TOC目录
分享一段之前和ChatGPT沟通得到的代码。 作用为传入一段HTML代码,并获取页面内的H2、H3、H4标签,组装成固定格式的html字符串返回。 const cheerio = require('cheerio'); module.exports = (html) => { if (!html) return; const $ = cheerio.load(html); let toc = "<ul&...
Subscribe to new posts
Processing your application
Please check your inbox and click the link to confirm your subscription
There was an error sending the email