From 3d5c7535675fb078a506cc776e8627006973568a Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Sun, 14 Jun 2026 07:00:19 +0300 Subject: [PATCH 1/2] feat(processor): manually inject frontmatter with source tag --- plugins/processor/index.mjs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/processor/index.mjs b/plugins/processor/index.mjs index 42c34cdf..f2d6950c 100644 --- a/plugins/processor/index.mjs +++ b/plugins/processor/index.mjs @@ -1,4 +1,6 @@ import { Converter, ReflectionKind, Renderer } from 'typedoc'; +import { MarkdownPageEvent } from 'typedoc-plugin-markdown'; +import { getSourceMetadata } from './metadata.mjs'; import { writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { applyExportEqualsReflections } from './exportEquals.mjs'; @@ -62,6 +64,17 @@ export function load(app) { } }); + app.renderer.on(MarkdownPageEvent.END, page => { + const sourceMeta = getSourceMetadata(page.model); + + if (sourceMeta && sourceMeta.sourceRelativePath) { + const source = `https://github.com/webpack/webpack/blob/main/lib/${sourceMeta.sourceRelativePath}`; + const frontmatter = `---\n` + `source: ${source}\n` + `---\n\n`; + + page.contents = frontmatter + page.contents; + } + }); + app.renderer.on(Renderer.EVENT_END, () => { // doc-kit resolves custom type annotations from this map while generating // HTML, so use the final router URLs instead of recomputing paths here. From 0deb1c6eeafd8ab7b3b65085429ee216a3d5c227 Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Sun, 14 Jun 2026 19:06:23 +0300 Subject: [PATCH 2/2] fixup! --- plugins/processor/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/processor/index.mjs b/plugins/processor/index.mjs index f2d6950c..3f530306 100644 --- a/plugins/processor/index.mjs +++ b/plugins/processor/index.mjs @@ -68,7 +68,7 @@ export function load(app) { const sourceMeta = getSourceMetadata(page.model); if (sourceMeta && sourceMeta.sourceRelativePath) { - const source = `https://github.com/webpack/webpack/blob/main/lib/${sourceMeta.sourceRelativePath}`; + const source = `https://github.com/webpack/webpack/edit/main/lib/${sourceMeta.sourceRelativePath}`; const frontmatter = `---\n` + `source: ${source}\n` + `---\n\n`; page.contents = frontmatter + page.contents;