Skip to content

v2.5.0

Choose a tag to compare

@basnijholt basnijholt released this 14 Jan 15:56
· 7 commits to main since this release
fd06857

New Features

Standardize Code Fences for External Markdown Processors

Added new CLI flags and Python API parameters to standardize code fences, making output compatible with markdown processors like mkdocs, Zensical, and pandoc that don't understand the python markdown-code-runner syntax.

CLI

# Execute code AND standardize all code fences
markdown-code-runner --standardize input.md
markdown-code-runner -s input.md

# Only standardize without executing code
markdown-code-runner --no-execute --standardize input.md
markdown-code-runner -n -s input.md

Python API

from markdown_code_runner import update_markdown_file, standardize_code_fences

# Execute and standardize in one pass
update_markdown_file("README.md", "output.md", standardize=True)

# Only standardize, skip execution
update_markdown_file("README.md", "output.md", execute=False, standardize=True)

# Use the utility function directly
clean_content = standardize_code_fences(content)

What It Does

The --standardize flag post-processes output to transform code fences like:

```python markdown-code-runner
print('hello')
```

Into standard code fences:

```python
print('hello')
```

Closes