Skip to main content

Bidirectional MyST ↔ Quarto converter

Project description

mystquarto

Bidirectional MyST Markdown ↔ Quarto converter. Transforms directives, roles, config files, and frontmatter between the two formats.

Installation

pip install mystquarto

Or run directly:

uvx myst2quarto docs/

Usage

# Convert MyST → Quarto
myst2quarto docs/ -o docs-quarto/

# Convert Quarto → MyST
quarto2myst docs/ -o docs-myst/

# Unified CLI
mystquarto to-quarto docs/
mystquarto to-myst docs/

Options

Flag Description
-o DIR / --output DIR Output directory (default: <input>-quarto/ or <input>-myst/)
--in-place Modify files in-place
--config-only Only convert config files (myst.yml_quarto.yml)
--no-config Skip config file conversion
--dry-run Show what would change without writing
--strict Treat warnings as errors

What it converts

Block directives

MyST Quarto
```{code-cell} python ```{python}
:tags: [remove-input] #| echo: false
:tags: [remove-output] #| output: false
:tags: [remove-cell] #| include: false
:tags: [hide-input] #| code-fold: true
```{figure} path ![caption](path){#fig-id width=X}
```{math} + :label: $$ ... $$ {#eq-id}
```{note} ::: {.callout-note}
```{warning} ::: {.callout-warning}
```{tip} ::: {.callout-tip}
```{important} ::: {.callout-important}
```{admonition} Title ::: {.callout-note title="Title"}
::::{tab-set} / :::{tab-item} ::: {.panel-tabset} / ## Label
```{margin} ::: {.column-margin}
```{image} url ![alt](url){width=X}
```{table} Caption Markdown table + : Caption {#tbl-id}
```{bibliography} Removed (Quarto handles via config)
```{tableofcontents} Removed (Quarto handles via config)
```{mermaid} Pass through (both support it)

Inline roles

MyST Quarto
{eval}`expr` `{python} expr`
{cite}`key` [@key]
{cite:t}`key` @key
{cite:p}`key` [@key]
{cite}`a,b,c` [@a; @b; @c]
{numref}`fig-id` @fig-id
{ref}`label` @label
{eq}`label` @eq-label
{doc}`path` [path](path.qmd)

Config files (myst.yml_quarto.yml)

myst.yml _quarto.yml
project.title title: or book.title:
project.authors author:
project.bibliography bibliography:
project.toc book.chapters:
site.template: book-theme project.type: book
project.exports[format: pdf] format.pdf:

Frontmatter (per-file YAML)

MyST Quarto
kernelspec: {name: python3} jupyter: python3
label: id:
exports: format:

Architecture

No heavy dependencies — just click + pyyaml. The converter uses a regex-based line scanner with a directive stack that handles nested fences (both backtick and colon styles), parses options blocks, and dispatches to transform functions. All transforms are bidirectional.

Development

git clone https://github.com/MaxGhenis/mystquarto
cd mystquarto
uv sync --dev
uv run pytest tests/ -v      # 225 tests
uv run ruff check src/ tests/

License

MIT-0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mystquarto-0.1.1.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mystquarto-0.1.1-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file mystquarto-0.1.1.tar.gz.

File metadata

  • Download URL: mystquarto-0.1.1.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mystquarto-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a8e8232ad8372d7ff9402afb0f769058edbc54765b35ee12537200cc78cf012f
MD5 8f8eaa7eb60abae2beaa14bcfdfcd493
BLAKE2b-256 b249b28f8f0228c6b10c7c4984fce5f2c74ed9d8fd475b3bfdde05d43779c0ec

See more details on using hashes here.

File details

Details for the file mystquarto-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mystquarto-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mystquarto-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb36e2b3c1594571c7d95028b120416682641a5a7d3919febbb07ab815ab84df
MD5 5de1b21a3d16854a930afe66afd1466d
BLAKE2b-256 fddad3eaec4adfb7c5a5b1e9294854594fbf557ff7956455007b1c96ef52c0d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page