Closed yannickseurin closed 5 months ago
This ended up turning into a big rewrite, but I'm happy with the outcome. The upshot is that we can now configure in a uniform style like:
[preprocessor.admonish.directive.builtin.warning]
collapsible = true
[preprocessor.admonish.directive.custom.expensive]
icon = "./money-bag.svg"
color = "#24ab38"
collapsible = true
aliases = ["money", "cash", "budget"]
The old style configuration for custom
is supported backwards compatibly. This leaves room for further PRs to add overrides for builtin directives aliases, icons etc. if people want that in future.
Very neat, thanks for this! And sorry for having prompted such a big rewrite :)
Very neat, thanks for this! And sorry for having prompted such a big rewrite :)
Not a problem! It was in my mind for a while and it worked to get it out here. Also prompted by problems with the existing format and the old version of toml
that mdbook
uses internally - it has a bug in it such that the table-of-tables approach I was using literally broke when used :disappointed:
Allows to set the collapsible property independently for each directive (overwriting the global default) as suggested in issue #169 .
collapsible
subfield in the directive declaration;AdmonitionDefaults
.When resolving a block, the value of collapsible is set to
Note that the updated documentation specifies that the table for builtin directives must be declared as
which assumes that PR 173 is merged (otherwise it should be
builtins-collapsible
).