-
Notifications
You must be signed in to change notification settings - Fork 177
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
[typedoc-plugin-markdown] How to change title format #450
Comments
I also wish there was an option to override the Handlebars helpers. At the moment, here is my hacky workaround: // override helper to exclude ReflectionKind from sidebar
Handlebars.registerHelper(
'reflectionTitle',
function (shouldEscape = true) {
const title = [''];
title.push(
shouldEscape ? escapeChars(this.model.name) : this.model.name,
);
if (this.model.typeParameters) {
const typeParameters = this.model.typeParameters
.map((typeParameter) => typeParameter.name)
.join(', ');
title.push(`<${typeParameters}${shouldEscape ? '\\>' : '>'}`);
}
return title.join('');
},
);
const _registerHelper = Handlebars.registerHelper;
Handlebars.registerHelper = function (...args): void {
if (args[0] === 'reflectionTitle') {
return;
}
return _registerHelper.apply(Handlebars, args);
};
function escapeChars(str) {
return str
.replace(/>/g, '\\>')
.replace(/_/g, '\\_')
.replace(/`/g, '\\`')
.replace(/\|/g, '\\|');
} |
@tgreyuk cool just tried out But I had to remove the Why is there a slash after |
Hi @Dr-Electron,
There shouldn't be. Is this output from Docusaurus?
This can be achieved with |
We import it in docusaurus but it is not generated by the docusaurus plugin. (We pull the reference docs from outside of docusaurus).
Lovely ❤️ . Really nice changes you made in the next version ❤️ |
Ok, I assume you are using Docusaurus 2?. The issue is that the output is now MDX but Docusaurus is not MDX compatible (this is handled by the Docusaurus plugin). This looks to be the same issue as raised here #564 . I think the best thing here is to offer an opt-out of MDX. |
@Dr-Electron in the mean time i've had another idea. You can use the docusaurus-plugin without executing |
Yeah we are still using docusaurus v2. I guess an update to v3 wouldn't help here either? 🤔 |
The problem with this is, that I need to install docusaurus in that repo too. Only to generate the docs, which are then uploaded and used by the main docusaurus project 😅 |
Upgrading to Docusaurus v3 will fix the issue.
Ok that makes sense. I think there does need to be a workaround for this. |
Closing this as original issue fixed. The mdx issues should be fixed by adding the following to
|
Hi,
Currently we are using your project to create markdown files which we import in Docusaurus. But the title of the the pages is always
Type: TypeName
. For example:Class: SomeClass
. In Docusaurus that creates the following sidebar structure:Would be nice if the title could be customised to only have
SomeClass
as title.I'm not sure if any other plugin like the frontmatter one could help here 🤔
The text was updated successfully, but these errors were encountered: