Closed crutchcorn closed 5 months ago
@crutchcorn The index.md pages have already been written before the event gets triggered on individual page. You need to update all the urls before the pages start to render.
You can do this with MarkdownRendererEvent.BEGIN
.
Try this:
app.renderer.on(
MarkdownRendererEvent.BEGIN,
/**
* @param {import("typedoc-plugin-markdown").MarkdownRendererEvent} renderer
*/ (renderer) => {
renderer.urls = renderer.urls?.map((urlMapping) => {
const name = urlMapping.url.split(".");
if (name[0] !== "index") {
name.splice(0, 1);
}
const newBasename = name.join(".").toLowerCase();
urlMapping.url = newBasename;
urlMapping.model.url = newBasename;
return urlMapping;
});
}
);
This is awesome, thank you so much for your help!
What package is the bug related to?
typedoc-plugin-markdown
Describe the issue
If I add the following custom plugin:
That I use to rename files to match our needs for TanStack Form, then it will generate the following
index.md
file:Despite the file paths being as such:
TypeDoc configuration
https://github.com/TanStack/form/pull/735/files#diff-3c52ddc750be1c8a30bf81c638ff98b62579ee9a3b446d703497f8cbd50dbb17
Expected behavior
The
index.md
paths should match the final output of the file names themselves