Skip to main content

Python port of Markdoc

Project description

markdoc-py

Python port of Markdoc, a Markdown-based authoring framework with custom tags and annotations.

Documentation: https://osks.github.io/markdoc-py/markdocpy.html

Status

This project is under active development. Core parsing, transforming, and HTML rendering are implemented, with fixture-based tests and JS parity fixtures.

Requirements

  • Python 3.13+
  • Node.js (only needed for JS parity fixture generation)

Install (dev)

make env

Quick start

import markdocpy as Markdoc

source = \"\"\"
# Hello

{% note title=\"A\" %}
Body
{% /note %}
\"\"\"

ast = Markdoc.parse(source)
content = Markdoc.transform(ast, {\"tags\": {\"note\": {\"render\": \"note\", \"attributes\": {\"title\": {}}}}})
html = Markdoc.renderers.html(content)

API

ast = Markdoc.parse(source)
content = Markdoc.transform(ast, config)
errors = Markdoc.validate(ast, config)
html = Markdoc.renderers.html(content)

Tests

make test

Lint / format

make lint
make lint-fix
make format

Docs

make docs

Fixtures

Python fixtures:

make fixtures

JS parity fixtures (requires Markdoc build):

cd /Volumes/Dev/priv/markdoc/markdoc
npm install
npm run build

cd /Volumes/Dev/priv/markdoc/pymarkdoc
make fixtures-js

Project layout

markdocpy/
  ast/
  parser/
  renderer/
  schema/
  transform/
  validator/
tests/
  fixtures/
  js/

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

markdoc_py-0.1.0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

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

markdoc_py-0.1.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file markdoc_py-0.1.0.tar.gz.

File metadata

  • Download URL: markdoc_py-0.1.0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for markdoc_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f40eaa624075d53617a6f787eedd17d262f1d7f22717b9ba494636cc3f1019b
MD5 109e1441eab2646dd3bbd52364da4029
BLAKE2b-256 45a028da2fe938fabac49d2778d44eec7894f6aebb359125ac1e4bc7a22ff1eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for markdoc_py-0.1.0.tar.gz:

Publisher: publish.yml on osks/markdoc-py

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

File details

Details for the file markdoc_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: markdoc_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for markdoc_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 783b0994fe77e9d6ac290d4a7a2b67f1168d20d7ba5cd98b0304bf23e4c9afae
MD5 446e8ce720e5842847c1057cba5657c3
BLAKE2b-256 e335e36a56d1cdb2e39d92eb7d3669b48c0e1757f33475e4f79b0416ed0eed32

See more details on using hashes here.

Provenance

The following attestation bundles were made for markdoc_py-0.1.0-py3-none-any.whl:

Publisher: publish.yml on osks/markdoc-py

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