-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin-pages: @page for any file #132
Comments
Hi there, Well, I have more or less planned to add the concept of front matter similar to what can be done with some static side generators like hugo. With such feature, you could specify a glob pattern to match pages, and specify the page infos (such as title or output) directly in the front matter. If you have any proposal/suggestion, I'm all ears. Yet, what you want requires a full rework of the pages building process, and is not really a top priority. |
I just thought that changelogs may be auto-generated & published in other tools (GitHub releases, npm tarball, whatever), and thus, adding a front-matter does not really fit. In your case, I would think of something like: {
pages: [
{match: './packages/*/CHANGELOG.md', template: {
moduleRoot: true,
title: "{{CURRENT_MODULE.NAME}}",
children: [
{source: "./CHANGELOG.md",title: "Changelog"}
]
}}
]
} This would be expanded as following: {
pages: [
{
moduleRoot: true,
title: "@example/foo",
children: [
{source: "./CHANGELOG.md",title: "Changelog"}
]
},
{
moduleRoot: true,
title: "@example/bar",
children: [
{source: "./CHANGELOG.md",title: "Changelog"}
]
},
]
} You could even append README to every modules with such pattern, making @knodes/typedoc-plugin-monorepo-readmes redundant: {
pages: [
{match: './packages/*/README.md', template: {
moduleRoot: true,
title: "{{CURRENT_MODULE.NAME}}",
source: "./README.md"
}}
]
} What do you think ? |
Could you please clarify what you want to do ? |
Im happy to use glob pattern in root config when be available! It will be nice if i can include index block directly to module subtree, but i understand that it not related to current topic and pages plug-in. Thanks! |
But, if we will use pages for readme - what we will see as module homepage?
|
As I mentioned above, glob patterns would be expanded to the non-glob format: {match: './packages/*/README.md', template: {
moduleRoot: true,
title: "{{CURRENT_MODULE.NAME}}",
source: "./README.md",
children: [
{ source: './CHAMGELOG.md', title: 'Changelog'}
]
}} This would expand to
Would that matches your expectations ? |
Ahh, it's can be managed using Yeah perfect! Thats exactly what I need. |
Yeah this option was introduced in Don't hesitate to suggest improvements to documentation |
Hi! can we also add ability to use fileName for page title somehow?
Not sure if its possible, but i want to achieve the ability to add any pages to any modules without adding extra configuration rows to root config Or maybe we can allow to add config for module lvl config? something like https://typedoc.org/guides/monorepo/#typedoc-package-config Thanks! |
Hi! So, about the 1st point, implementation is mostly done and you'll be able to interpolate almost any field from the path matched, using lodash templates in which you'll be able to use various fields from matches (including parents in case of nested templates), and use any lodash methods and a couple of cherry picked functions such as About the config splitted across packages, you can already somewhat emulate that by requiring modules configs from your root typedoc.js and do your stuff there. Built in support of composite config is not that trivial when you check how typedoc works, but I'm thinking about it. |
Sounds great! I'm waiting impatiently) |
You might use something like this: // typedoc.js
module.exports = {
pluginPages: {
pages: readdirSync('packages').reduce((acc, pkg) => {
return [
...acc,
...(require(resolve('packages', pkg, 'typedoc.js'))?.pluginPages?.pages ?? [])
];
}, []),
}
} |
Have modified your snippet to attach chengelogs if exists
but this works only if i place CHANGELOG.md to 'pages' folder inside package, even when 'childrenSourceDir': '.' My changelog file placed directly at package root.. Seems i miss something.. |
Yes this is due to an option I'm about to deprecate. Please set the source option to |
yep, adding |
Hi, So, I thought I was pretty done with template nodes. But after updating the docs, I realized that the result was super verbose as you can see in this repository's configuration. So I decided to made the integration of this feature more SOLID by normalizing interfaces & facilitate further extensions. That's why I decided to add the front-matter idea in the branch at the same time. By the way, having both globs & front matters would make the legacy declarative format almost useless; in most cases:
It also gives me a nice occasion to think about how to inject theme-specific options along with pages, and rework validation. I hope you'll understand and be patient. |
Hey there, Could you check out latest You'll find the documentation for the new loader I hope you'll like here: https://knodescommunity.github.io/typedoc-plugins/v0.23.5-next.1/pages/_knodes_typedoc_plugin_pages/managing-pages-menu-items/using-the-front-matter-loader.html The documentation is still a bit lacking, but I'm working on it. |
Hi!
Is its possible to add a link to page for not described pages in config?
example:
I want to add the link to my change-log file at the bottom of readme, i have around 40 packages and all of theme have readme and changelog files at the root. i do not want to discribe the whole pages tree..
The text was updated successfully, but these errors were encountered: