Skip to main content

Python bindings for Quillmark - format-first Markdown rendering

Project description

Quillmark — Python bindings

Python bindings for Quillmark's format-first Markdown rendering engine.

Maintained by TTQ.

Installation

pip install quillmark

Quick Start

from quillmark import Quillmark, Document, OutputFormat

engine = Quillmark()
quill = engine.quill_from_path("path/to/quill")

markdown = """~~~card-yaml
$quill: my_quill
$kind: main
title: Hello World
~~~

# Hello
"""

parsed = Document.from_markdown(markdown)
result = quill.render(parsed, OutputFormat.PDF)
result.artifacts[0].save("output.pdf")

# Round-trip: mutate, emit, re-parse
parsed.set_field("title", "Updated")
emitted = parsed.to_markdown()
reparsed = Document.from_markdown(emitted)
assert reparsed.payload["title"] == "Updated"

API Overview

Quillmark

engine = Quillmark()
engine.registered_backends()      # ['typst']
quill = engine.quill_from_path("path/to/quill")

Quill

quill = engine.quill_from_path("path")
result = quill.render(parsed, OutputFormat.PDF)
session = quill.open(parsed)
quill.dry_run(parsed)

quill.backend            # "typst"
quill.supports_canvas    # True when the backend supports canvas preview
quill.schema             # structured dict of the quill's document schema
quill.schema_yaml        # same schema rendered as a YAML string
quill.blueprint          # auto-generated annotated Markdown blueprint

RenderSession

Created via quill.open(doc); reuses the compiled snapshot across renders.

session = quill.open(parsed)
session.page_count
session.backend_id            # backend that produced this session
session.supports_canvas
session.warnings              # session-level warnings (e.g. version shims)
session.render(OutputFormat.SVG, [0])  # render a page subset

Document

doc = Document.from_markdown(markdown)
emitted = doc.to_markdown()          # canonical Quillmark Markdown

# Versioned storage DTO — use this to persist a document across a
# process restart or crate upgrade. The wire format is frozen per
# schema version, whereas Markdown syntax evolves.
stored = doc.to_json()               # JSON string carrying a schema version
restored = Document.from_json(stored)
assert restored.to_markdown() == doc.to_markdown()

# Detect "is this content a stored DTO or raw Markdown?" without exceptions.
doc = Document.try_from_json(blob) or Document.from_markdown(blob)

# Schema-version probing for cross-version migrations.
v = Document.schema_version_of(blob)          # raw tag, even for future versions
current = Document.current_schema_version()   # version this build writes

# Cheap structural equality and cloning.
copy = doc.clone()                            # independent handle
assert copy == doc                            # structural compare; warnings ignored

# O(1) card count.
doc.card_count

from_json raises ParseError on malformed JSON or an unknown schema tag. A DTO-reconstructed document has no parse-time warnings.

Development

uv venv
uv pip install -e ".[dev]"
uv run pytest

License

Apache-2.0

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

quillmark-0.83.0.tar.gz (3.2 MB view details)

Uploaded Source

Built Distributions

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

quillmark-0.83.0-cp310-abi3-win_amd64.whl (14.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

quillmark-0.83.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

quillmark-0.83.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

quillmark-0.83.0-cp310-abi3-macosx_11_0_arm64.whl (13.8 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file quillmark-0.83.0.tar.gz.

File metadata

  • Download URL: quillmark-0.83.0.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quillmark-0.83.0.tar.gz
Algorithm Hash digest
SHA256 8a71b0c23a5f82c6b921b97cfe52bbaf1552b452a8f96b313edddbf405fe842e
MD5 16af94742af0aa1067e97aa0cc952fdc
BLAKE2b-256 2e4a1e3c768cce15552d3deffba35013841af6126d1e554b8c46353ce22b3a32

See more details on using hashes here.

Provenance

The following attestation bundles were made for quillmark-0.83.0.tar.gz:

Publisher: release.yml on quillmark-org/quillmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quillmark-0.83.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: quillmark-0.83.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 14.0 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quillmark-0.83.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3a85416a9f629471a8a9eabb0565bee9d70337c46dac51fde1cf1c67e72cb2c0
MD5 4ad34786e579ed786d43dffc49f882c0
BLAKE2b-256 5f5f0061cf2774212afd7945c5906f30ae0da138472e6bbb13a3c6e0a5347ff1

See more details on using hashes here.

Provenance

The following attestation bundles were made for quillmark-0.83.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on quillmark-org/quillmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quillmark-0.83.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for quillmark-0.83.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 173deef358aa79c4ca1d810cb9bf3d1bfe1f221310ac7101e1ecf461830d9db1
MD5 9ca68973ad01b3b7a265fce1b2c80862
BLAKE2b-256 d6fde3699d18bfb0e4eec694b0be3a36d2dbd4559a610367bd91ddba9a529de0

See more details on using hashes here.

Provenance

The following attestation bundles were made for quillmark-0.83.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on quillmark-org/quillmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quillmark-0.83.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for quillmark-0.83.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36e321693fee7ed6338141199b3d5ea717a971d293db4df58b827fc56d3a036e
MD5 979015c24fbbba6fbd8da0792b18fd7b
BLAKE2b-256 dd39f0aef9b40177b06892a85f2a6a434a7d9b8f039014656095a4558183f808

See more details on using hashes here.

Provenance

The following attestation bundles were made for quillmark-0.83.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on quillmark-org/quillmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quillmark-0.83.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for quillmark-0.83.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe14386a414cf1e60ab38b84af5516450341b0e9206cb6630511e755d58357f8
MD5 46171e517aaba295c9b921d179e12a37
BLAKE2b-256 7f347bfa01df59a7740585f21d12e9e15f92f57cf738fee7e03f3fed653d5315

See more details on using hashes here.

Provenance

The following attestation bundles were made for quillmark-0.83.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on quillmark-org/quillmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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