executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
708 stars 189 forks source link

For v3.0.1: indented directive options no longer recognised #922

Closed JoeZiminski closed 2 months ago

JoeZiminski commented 2 months ago

What version of myst-parser are you using?

3.0.0

What version dependencies are you using?

```Package Version ----------------------------- ----------- ablog 0.11.8 accessible-pygments 0.0.4 alabaster 0.7.16 attrs 23.2.0 Babel 2.14.0 bcrypt 4.1.2 beautifulsoup4 4.12.3 bleach 6.1.0 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 colorama 0.4.6 cryptography 42.0.5 defusedxml 0.7.1 docutils 0.20.1 fancylog 0.3.0 fastjsonschema 2.19.1 feedgen 1.0.0 idna 3.7 imagesize 1.4.1 invoke 2.2.0 Jinja2 3.1.3 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 jupyter_client 8.6.1 jupyter_core 5.7.2 jupyterlab_pygments 0.3.0 linkify-it-py 2.0.3 lxml 5.2.1 markdown-it-py 3.0.0 MarkupSafe 2.1.5 mdit-py-plugins 0.4.0 mdurl 0.1.2 mistune 3.0.2 myst-parser 2.0.0 nbclient 0.10.0 nbconvert 7.16.3 nbformat 5.10.4 nbsphinx 0.9.3 numpydoc 1.7.0 packaging 24.0 pandocfilters 1.5.1 paramiko 3.4.0 pip 23.3.1 platformdirs 4.2.1 pycparser 2.22 pydata-sphinx-theme 0.15.2 Pygments 2.17.2 PyNaCl 1.5.0 python-dateutil 2.9.0.post0 pywin32 306 PyYAML 6.0.1 pyzmq 26.0.2 referencing 0.35.0 requests 2.31.0 rich 13.7.1 rpds-py 0.18.0 setuptools 68.2.2 setuptools-scm 8.0.4 simplejson 3.19.2 six 1.16.0 snowballstemmer 2.2.0 soupsieve 2.5 Sphinx 7.1.2 sphinx-argparse 0.4.0 sphinx-autodoc-typehints 2.0.1 sphinx_design 0.5.0 sphinx-sitemap 2.5.1 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.6 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 1.1.10 tabulate 0.9.0 tinycss2 1.3.0 tomli 2.0.1 tornado 6.4 traitlets 5.14.3 typing_extensions 4.11.0 uc-micro-py 1.0.3 urllib3 2.2.1 watchdog 4.0.0 webencodings 0.5.1 wheel 0.41.2 ```

What operating system are you using?

Windows

Describe the Bug

In version 2.0.0 I have the images with content (I use backticks in the real version but use ::: here for formatting reasons), e.g.:

:::{image} /_static/blog_images/neuroblueprint/NeuroBlueprint_project_tree_dark.png
   :align: center
   :class: only-dark
   :width: 650px
:::
:::{image} /_static/blog_images/neuroblueprint/NeuroBlueprint_project_tree_light.png
   :align: center
   :class: only-light
   :width: 650px
:::

but the content is not respected (e.g. image size) and the warning reads:

16: WARNING: 'image': Has content, but none permitted [myst.directive_parse]

I checked the changelog and couldnt see anything immediately relevant so listed as bug, but maybe this is a new feature I am misunderstanding.

Expected Behavior

Image formats with content as directed .

To Reproduce

I believe building with any image content should show the error.

welcome[bot] commented 2 months 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:

chrisjsewell commented 2 months ago

Heya, ah I think I know why this is, if you have the options without the indentation, it should work, e.g.

```{image} /_static/blog_images/neuroblueprint/NeuroBlueprint_project_tree_light.png
:align: center
:class: only-light
:width: 650px


let me know?

But yeh I can fix this regression (and add a test to catch it 😅) hopefully in the next day or two
JoeZiminski commented 2 months ago

Thanks for the quick response @chrisjsewell, that fixed it!! 😄 Cheers

chrisjsewell commented 2 months ago

Cheers, yeh one of those things where an "implementation detail" becomes part of the spec lol; I must have removed the lstrip when checking if a line is part of the option block, but didn't account for this possibility of having indented options.

chrisjsewell commented 2 months ago

I use backticks in the real version but use ::: here for formatting reasons

FYI you know you can just surround with more backticks, e.g.

``````outer
````inner
```more-inner
content
ru-fu commented 2 months ago

But yeh I can fix this regression (and add a test to catch it 😅) hopefully in the next day or two

Thank you! We're seeing the same issue, with lots of warnings for all the indented options ...

JoeZiminski commented 2 months ago

I use backticks in the real version but use ::: here for formatting reasons

FYI you know you can just surround with more backticks, e.g.

``````outer
````inner
```more-inner
content

Awesome, thanks!!