TOC item paragraph customization can be solved by allowing user to specify a mapping of levels to style names (that would be used instead of ToC{level}). In addition to that, logic in build can be updated to skip adding style if style with such name is already present (that would allow the user to customize the style by creating ToC{level} style themself).
Customizing the paragraph tab is a bit more difficult but can be solved by allowing the user to set a custom tab (per level) by calling a function on TableOfContents or by providing a way for user to set Paragraph instance which will be later be cloned per each TOC item (or by setting a factory of Paragraph).
Describe alternatives you've considered
It does not seem that there are any alternative solutions here. If there are - please let me know!
Additional context
Please let me know what you think about possible solutions, and I will be happy to submit an MR for this!
First of all, thank you for maintaining this crate! It is really useful!
Is your feature request related to a problem? Please describe.
When creating a table of contents, it is created with a specific style (i.e., normal text without any additional formatting and "..." as tab leader):
If a different style is needed (for example, bold text and no tab leader) it is not possible to set, because:
add_style
because if the style is added it will be overridden when building document anyway.TableOfContentsItem
and it does not seem that it can be changed in any way.Describe the solution you'd like
TOC item paragraph customization can be solved by allowing user to specify a mapping of levels to style names (that would be used instead of
ToC{level}
). In addition to that, logic inbuild
can be updated to skip adding style if style with such name is already present (that would allow the user to customize the style by creatingToC{level}
style themself).Customizing the paragraph tab is a bit more difficult but can be solved by allowing the user to set a custom tab (per level) by calling a function on
TableOfContents
or by providing a way for user to setParagraph
instance which will be later be cloned per each TOC item (or by setting a factory ofParagraph
).Describe alternatives you've considered
It does not seem that there are any alternative solutions here. If there are - please let me know!
Additional context
Please let me know what you think about possible solutions, and I will be happy to submit an MR for this!
Thank you!