Update heading rules

This commit is contained in:
2026-06-26 00:20:52 +08:00
parent c9225c2b26
commit 351592d437

View File

@@ -148,8 +148,7 @@ export class HighlightedMarkdown extends Component {
{ {
shouldProcessNode: (node) => /^h[123456]$/.test(node.name), shouldProcessNode: (node) => /^h[123456]$/.test(node.name),
processNode(node, children, index) { processNode(node, children, index) {
let currentLevel = +node.name[1]; const currentLevel = Math.min(+node.name[1] + 2, 5);
if (currentLevel < 3) currentLevel = 3;
const HeadingTag = `h${currentLevel}`; const HeadingTag = `h${currentLevel}`;
return <HeadingTag key={index}>{children}</HeadingTag>; return <HeadingTag key={index}>{children}</HeadingTag>;
}, },