Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior of 'name' argument in code-block directive #56

Closed
rossbar opened this issue Feb 19, 2020 · 3 comments
Closed

Inconsistent behavior of 'name' argument in code-block directive #56

rossbar opened this issue Feb 19, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@rossbar
Copy link
Contributor

rossbar commented Feb 19, 2020

Describe the bug
From limited testing, it appears that the name: argument requires a string to work within the {code-block} directive. This is inconsistent with how name: appears to work within other directives such as {figure} or {table}, for instance.

To Reproduce
The following works for creating a label called fig:my that can then be used in the text via the {ref} or {numref} roles. This works with the table directive as well.

​```{figure} my_figure.png
---
name: fig:my
---
​```

However, the following fails to define a label (a sphinx warning about an undefined label is raised if you try to reference code:my in the document):

​```{code-block} python
---
name: code:my
---
def my_fun(): pass
​```

The following works however (note the quotes around the label name):

​```{code-block} python
---
name: 'code:my'
---
def my_fun(): pass
​```

Expected behavior

I am not a sphinx/docutils expert, so maybe this is the expected behavior. However I would expect the name: argument to result in consistent behavior within all directives for which it is defined.

Screenshots
n/a

Environment (please complete the following information):

  • Python Version: 3.8.1
  • Package Version: myst_parser@4150051
@rossbar rossbar added the bug Something isn't working label Feb 19, 2020
@rossbar
Copy link
Contributor Author

rossbar commented Feb 19, 2020

NVM - the issue I reported is incorrect. The caption: must be defined as well within the code-block for the name: to work.

@rossbar rossbar closed this as completed Feb 19, 2020
@chrisjsewell
Copy link
Member

Always happy when an issue gets closed before I’ve even looked at it 😆

@rossbar
Copy link
Contributor Author

rossbar commented Feb 19, 2020

I'm getting a little trigger happy 😨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants