有时候有意思比有意义更有意义!

All work and no play makes Jack a dull boy

Become a subscriber

See what we’ve written lately

1900
Meet our author

Ghost使用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&...

You’ve successfully subscribed to @1900'Blog
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Success! Your email is updated.
Your link has expired
Success! Check your email for magic link to sign-in.