Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"dependencies": {
"colors": "1.4.0",
"finalhandler": "^2.1.1",
"marked": "^12.0.2",
"marked": "^16.4.0",
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR metadata/title says marked is bumped to 16.3.0, but package.json now pins ^16.4.0. Please align the PR title/description (or the dependency version) so reviewers and release notes match what is actually being shipped.

Copilot uses AI. Check for mistakes.
"puppeteer": "^24.37.5",
"sade": "^1.8.1",
"serve-static": "^2.2.1"
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions src/core/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ const gtEntity = />/gm;
const ampEntity = /&/gm;

class Renderer extends marked.Renderer {
code(code, infoString, isEscaped) {
const { language, ...metaData } = Renderer.parseInfoString(infoString);
code({ text, lang, escaped }) {
const { language, ...metaData } = Renderer.parseInfoString(lang || "");

// regex to check whether the language is webidl
if (/(^webidl$)/i.test(language)) {
return `<pre class="idl">${code}</pre>`;
return `<pre class="idl">${text}</pre>`;
}

const html = super
.code(code, language, isEscaped)
.code({ text, lang: language, escaped })
.replace(`class="language-`, `class="`);

const { example, illegalExample } = metaData;
Expand All @@ -40,9 +40,9 @@ class Renderer extends marked.Renderer {
return html.replace("<pre>", `<pre title="${title}" class="${className}">`);
}

image(href, title, text) {
image({ href, title, text, tokens }) {
if (!title) {
return super.image(href, title, text);
return super.image({ href, title, text, tokens });
}
const html = String.raw;
return html`
Expand Down Expand Up @@ -76,20 +76,20 @@ class Renderer extends marked.Renderer {
return { language, ...metaData };
}

heading(text, level, raw) {
heading({ tokens, depth, text }) {
const headingWithIdRegex = /(.+)\s+{#([\w-]+)}$/;
if (headingWithIdRegex.test(text)) {
const [, textContent, id] = text.match(headingWithIdRegex);
return `<h${level} id="${id}">${textContent}</h${level}>`;
return `<h${depth} id="${id}">${textContent}</h${depth}>`;
}
return super.heading(text, level, raw);
return super.heading({ tokens, depth });
}
}

/** @type {import('marked').MarkedOptions} */
const config = {
gfm: true,
renderer: new Renderer(),
renderer: /** @type {any} */ (new Renderer()),
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting the renderer instance to any disables type checking for the Marked renderer API, which can hide signature/return-type mismatches during this major upgrade. Prefer tightening this to the appropriate Marked renderer type (e.g. MarkedOptions['renderer'] / RendererObject) and/or adding JSDoc types for the overridden methods so config remains type-safe.

Suggested change
renderer: /** @type {any} */ (new Renderer()),
renderer: /** @type {import('marked').MarkedOptions['renderer']} */ (new Renderer()),

Copilot uses AI. Check for mistakes.
};

/**
Expand Down
Loading