From bb7e1a5030c9794a98d6e798f26c14a2d65cc6c8 Mon Sep 17 00:00:00 2001 From: EJ Mercer Date: Mon, 19 Aug 2024 12:39:20 -0600 Subject: [PATCH] Improve detection of YAML option block (fixes #963) --- myst_parser/parsers/directives.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/myst_parser/parsers/directives.py b/myst_parser/parsers/directives.py index 45bf593e..a4354592 100644 --- a/myst_parser/parsers/directives.py +++ b/myst_parser/parsers/directives.py @@ -192,7 +192,8 @@ def _parse_directive_options( content_lines = content.splitlines() yaml_lines = [] while content_lines: - if not content_lines[0].lstrip().startswith(":"): + next_line = content_lines[0].lstrip() + if not next_line.startswith(":") or next_line.lstrip(":").startswith("{"): break yaml_lines.append(content_lines.pop(0).lstrip()[1:]) options_block = "\n".join(yaml_lines)