typedoc-default-themes
typedoc-default-themes copied to clipboard
Possibility to customize the default values of the filters checkboxes
In my current documentation, I'd like the filters to be displayed with these default values: visibility: public inherited: false externals: true only-exported: true
but for now, your hardcoded values are visibility: private inherited: true externals: true only-exported: false
Is there's a way to customize these values through a custom theme ? Or through properties of typedoc build ?
You can do this with a custom theme:
- Create
<theme>/partials/header.hbs - Copy the content of https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/header.hbs to that file.
- Change the defaults for the checkbox.
For visibility, it is not a checkbox. So it has not impact until you click on it. I will try to add a script in header to force the localStorage values instead
Ah, good point there, I forgot that that was controlled via JS. I'd be open to a PR that makes the JS pick up the default from the HTML instead of hardcoding it
https://github.com/TypeStrong/typedoc-default-themes/blob/042f26df8b6c8445d944e697ad5124c8151cfb15/src/default/assets/js/src/typedoc/components/Filter.ts#L142
Thanks
I have been trying to set the default of inherited to false, but with no luck. When I edit the html and the js like this:
this.optionInherited = new FilterItemCheckbox("inherited", false)
(set the default to false)
<input type="checkbox" id="tsd-filter-inherited" />
(removed the checked property)
then the functionality reverses: the checkbox is turned off by default, but the filter is still on. What did I do wrong?
If you add the toggle-externals class to the root html element it will start off with externals disabled. Checkbox does not work correctly though, you have to toggle it twice for it to start working. Would love to see this as a configuration option for this theme.
Another issue is when you disable externals and navigate to an external type (e.g. as a return type from a non-external) you land on a blank page and have to toggle externals for the information to be visible