Open Yoshanuikabundi opened 1 year ago
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Heya, this is to some extent intended; colon fences are principally intended for "nested markdown" content, whereas backtick fences are for non-markdown content. Is there a reason not to use backtick fences?
It's really nice to be able to syntactically see the difference between a code block and a directive - both as someone reading a lot of markdown and especially for tooling. With colon code fences, I can write and use markdown code block lints and not worry about getting wires crossed. If I could, I'd turn off backtick directives altogether so that each feature has its own syntax. It's also a lot of churn to update, and it's wierd to have to remember this for only one directive.
The docs seem to describe the feature as being for this purpose, and don't mention anything about it being for nested markdown in any way that doesn't also apply to backticks: https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#code-fences-using-colons
Since I just ran into the same problem, I thought I'll add my 2 cents here because I grew quite fond of MyST recently :-)
In my case, there was no particular reason why I used :::
instead of ```
, I just expected both to behave similar. This issue was the only soruce of information that clarified that colon-fence syntax is not supported for {eval-rst}
, (since the error-message did not help to pinpoint why things went wrong)
As I see it, your question "Is there a reason not to use backtick fences?" can also be reversed... is there a reason why you consider it a bad idea to allow using :::{eval-rst}
(aside of enforcing syntax-conventions)?
From your docs I expected that :::
is practically a synonym for ```
and can be used for any directive.
By adding "colon_fence" to myst_enable_extensions (in the sphinx conf.py configuration file), you can also use ::: delimiters to denote directives, instead of ```.
As I ran into this issue as well, I just wanted to give you a quick "hands-up" as well.
I'm namely responsible for managing all the documentation produced within the company I work for.
The issue here is that we have lots of different documentation projects currently running which are maintained by my colleagues.
As the system is already up for quite some time now, most of them have indifferently using the ...
or :::
for declaring markdown or 'non-markdown' content (namely eval-rst
).
This summer I decided to upgrade our compilation infrastructure (via containers) to bring them to the last version of Sphinx (we where still running a rather old 5.X.X version of Sphinx) as well as the whole environment, including Myst-Parser.
And that's where I ran into troubles because it forces me not only to "update" all the users about the change but also to adapt all the sources in order to get everything back to normal (meaning errorless compilations)...
Describe the bug
context When I try to create an
eval-rst
directive with colon fences and curly braces, I get an error:conf.py:
:index.md
:expectation I expected the document to build successfully.
bug But instead I get this error message:
problem
This is a very confusing error as the directive exists, it's just this particular combination fails. The same combination works with other directives:
Reproduce the bug
Note that using backtick fences:
works as expected; only the combination fails.
List your environment
I'm not using jupyter-book at all, but running MyST Parser through Sphinx. I confirmed this behavior on MyST Parser v0.19.1 and v1.0.0, but the bug does not exist on v0.18.1. I haven't tested on other versions (which do not exist on Conda Forge). The bug is present on Sphinx 5.3.0 and 6.1.3. An example Conda environment that produces the issue is:
conda list
My OS is up-to-date Arch.