docs: add canary docs for <head> modifications (#3173)

Adds v2 version of "Modyfing the <head>" example. This is the next to
last page that needs to be updated (though the other only requires minor
changes to types).
This commit is contained in:
Christian Svensson
2025-08-05 23:50:58 +02:00
committed by GitHub
parent 4818faad1d
commit e014d80a0f
5 changed files with 212 additions and 4 deletions
+2 -1
View File
@@ -82,6 +82,7 @@ const LOGOS = [
export interface MarkdownHeading {
id: string;
html: string;
level: number;
}
class DefaultRenderer extends Marked.Renderer {
@@ -127,7 +128,7 @@ class DefaultRenderer extends Marked.Renderer {
const slug = slugger.slug(slugInput);
const text = this.parser.parseInline(tokens);
this.headings.push({ id: slug, html: text });
this.headings.push({ id: slug, html: text, level: depth });
return `<h${depth} id="${slug}"><a class="md-anchor" tabindex="-1" href="#${slug}">${text}<span aria-hidden="true">#</span></a></h${depth}>`;
}