Skip to content

Parse code-block options with released MyST-Parser helpers - #1369

Merged
adamtheturtle merged 4 commits into
mainfrom
adamtheturtle/myst-directive-code-blocks
Nov 14, 2026
Merged

adamtheturtle merged 4 commits into
mainfrom
adamtheturtle/myst-directive-code-blocks

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

MyST code blocks with YAML-style options currently pass those options to the evaluator as executable source. Use the typed is_option_line() and options_to_items() helpers from released MyST-Parser 5.2.0 to parse options, and count source lines locally to preserve exact body whitespace and source positions.

Closes #1367.

This change is independent of upstream PRs and uses a normal myst-parser>=5.2.0 dependency. It needs no placeholder directive class, custom option mapping, lint/type suppressions or extra dependencies.

Validation: 1,013 tests passed with 100% line and branch coverage against MyST-Parser 5.2.0; all four type checkers and Pylint passed. Regression tests cover colon/YAML options, separators, trailing whitespace, empty bodies, unclosed option blocks, source positions and writing modified code without changing options.

@adamtheturtle adamtheturtle changed the title Parse MyST code-block options and offsets with MyST-Parser Parse code-block options with released MyST-Parser helpers Nov 14, 2026
@adamtheturtle
adamtheturtle marked this pull request as ready for review November 14, 2026 11:57
@adamtheturtle
adamtheturtle merged commit 9c4f60d into main Nov 14, 2026
22 checks passed
@adamtheturtle
adamtheturtle deleted the adamtheturtle/myst-directive-code-blocks branch November 14, 2026 12:12

This branch was successfully deployed

1 active deployment
development — cec3952b Deployed Nov 14, 2026 by adamtheturtle via pages #918
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use released MyST helpers to parse code-block options

1 participant