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.2.tar.gz (34.7 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.2-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mystquarto-0.1.2.tar.gz
  • Upload date:
  • Size: 34.7 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.2.tar.gz
Algorithm Hash digest
SHA256 8acd5b7980f3fcd598cd931e616dba2212ce18e1efd0e2052b49cf2c7aa256fa
MD5 940d629db7a6d0485a6b08d8f077bf0a
BLAKE2b-256 342b6a384b31b65612931f714485399b46bf362a2aed9d77ae65bc40afa359be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mystquarto-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 24.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c33c1e7eae2ecd834d751e0fa327eb28d46f6e072faa27b6ffa416ea117296a5
MD5 b6a26e925af725102afb9d1f76c2408f
BLAKE2b-256 ef9450c523ca97d7f882ea6f9b4b0d2c6a94c521a396e3f56f1e71595b1ecbf1

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