master
1import type { RemarkPlugin } from '@astrojs/markdown-remark';
2import { visit } from 'unist-util-visit';
3
4export const remarkHeadingShift: RemarkPlugin = function () {
5 return (tree) => {
6 visit(tree, 'heading', (node) => {
7 // 将所有标题层级加1(最大到6)
8 node.depth = Math.min(node.depth + 1, 6) as 1 | 2 | 3 | 4 | 5 | 6;
9 });
10 };
11};