dice-roller / vuepress-plugin

Plugin for VuePress that allows rolling dice
MIT License
0 stars 0 forks source link

[Bug]: Syntax breaks Vuepress menu #28

Closed GreenImp closed 1 year ago

GreenImp commented 1 year ago

This plugin is causing an issue which prevents headers from appearing in the menu, as mentioned here: https://github.com/vuepress/vuepress-next/issues/1329

The cause of this is how we're using the markdown-it-container plugin to render the dice roller.

The syntax for rolling is like:

::: roll 4d6 :::

However, the container plugin does not understand code fences (:::) on the same line.

If I change the markdown so that the closing fence is on the next line, then it works correctly:

::: roll 4d6
:::

There is a ticket for this on the container library, but it was closed as not a bug. However, I'm not sure this is correct, because the spec seems to suggest that a closing fence on the same line should be closed correctly: https://spec.commonmark.org/0.18/#example-95

Suggested solution

In the short-term, we can make sure to use the multi-line syntax:

::: roll 4d6
:::

In the long-term, I don't think that I can get it working correctly with the container plugin, so it may be worth looking into building a custom markdown-it plugin.

Maybe basing it on another plugin like this: https://github.com/camelaissani/markdown-it-include

GreenImp commented 1 year ago

This has been resolved by building a custom markdown parsing plugin for the roll notation