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

🐛 FIX: Convert empty directive option to None #452

Merged
merged 1 commit into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion myst_parser/parse_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def parse_directive_options(
raise DirectiveParsingError(f"Unknown option: {name}")
if not isinstance(value, str):
if value is True or value is None:
value = "" # flag converter requires no argument
value = None # flag converter requires no argument
elif isinstance(value, (int, float, datetime.date, datetime.datetime)):
# convertor always requires string input
value = str(value)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_renderers/fixtures/sphinx_directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ highlight (`sphinx.directives.code.Highlight`):
code-block (`sphinx.directives.code.CodeBlock`):
.
```{code-block}
:dedent:

a=1
a=1
```
.
<document source="notset">
Expand Down