Skip to content

feat(processor): manually inject frontmatter with source tag#136

Open
moshams272 wants to merge 2 commits into
webpack:mainfrom
moshams272:feat/manual-source-frontmatter
Open

feat(processor): manually inject frontmatter with source tag#136
moshams272 wants to merge 2 commits into
webpack:mainfrom
moshams272:feat/manual-source-frontmatter

Conversation

@moshams272

@moshams272 moshams272 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds source frontmatter in the API documentation pages, which is a blocker for the "Edit Page" button (#131) as mentioned in #132.

Instead of relying on the typedoc-plugin-frontmatter, this implementation manually injects the frontmatter block as a string at the beginning of the markdown content. By using MarkdownPageEvent.END hook to access the final markdown string and sourceRelativePath to construct the full GitHub repository URL. This approach provides more control over the output and prevents conflicts with doc-kit.

After:
image

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-doc-kit Ready Ready Preview, Comment Jun 14, 2026 4:09pm

Request Review

Comment thread plugins/processor/index.mjs Outdated

if (sourceMeta && sourceMeta.sourceRelativePath) {
const source = `https://github.com/webpack/webpack/blob/main/lib/${sourceMeta.sourceRelativePath}`;
const frontmatter = `---\n` + `source: ${source}\n` + `---\n\n`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const frontmatter = `---\n` + `source: ${source}\n` + `---\n\n`;
const frontmatter = `---\nsource: ${source}\n---\n\n`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I put it like that to be more readable if we add more tags in future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants