executablebooks / markdown-it-docutils

A markdown-it plugin for implementing docutils style roles/directives.
https://executablebooks.github.io/markdown-it-docutils/
MIT License
12 stars 9 forks source link

Errors are too strict, and break downstream rendering/expectations #42

Open rowanc1 opened 2 years ago

rowanc1 commented 2 years ago

Right now, the mystDirectiveError node gets created instead of the directive with a warning.

I think that we should change the logic to still create the correct token, but provide warnings. For example, adding an unknown option to a directive (e.g. with a typo), should still result in that directive node, but perhaps the mistyped option not available in the options and an error raised.

For example, this:

```{admonition} Title
:not-a-prop: value


Should parse to a valid `admonition`, node, rather than a `mystDirectiveError`, with a warning raised.

This is especially obvious when myst-js has a smaller implementation than a sphinx definition, the markup should parse optimistically and not error at the token phase.
rowanc1 commented 1 year ago

See #45 for other implementations and https://github.com/executablebooks/MyST-Parser/pull/682