jannis-baum / Vivify

Live Markdown viewer
GNU General Public License v3.0
42 stars 6 forks source link

Rethink markdown-it plugin options configuration #186

Open tuurep opened 2 months ago

tuurep commented 2 months ago

Background:

In tests/rendering/markdown-additional.md looking at the toc revealed an issue with how we allow using vivify's config.json to set the markdown-it options for markdown-it-table-of-contents plugin:

The toc links are supposed to have the same additional formatting as the headers, for example if I have a header:

## Introducing **foo** `bar`

the toc link should also have bold and code.

But it's not working because along with applying the settings from config.json, we set any other defaults as empty. (Relevant option: format in this table)

So we need to tweak the config handling such that:

This will also be relevant for #141 custom alert configuration.

tuurep commented 2 months ago

Turns out it's a little complicated for us - ideally the it would be handled in the plugins' side that when you set e.g. a single option, it doesn't throw away all the defaults. But this is not standard, plus plugins can have very individual ways to handle the default options.