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 markdoc
npm install
npm run build

cd 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.dev1.tar.gz (44.8 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.dev1-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: markdoc_py-0.1.0.dev1.tar.gz
  • Upload date:
  • Size: 44.8 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.dev1.tar.gz
Algorithm Hash digest
SHA256 ff31a40922b80f7e4f1fd1e4bb485ca96b0ddbd2d5840641e5706f5a1100e12a
MD5 48e9623ea0fa094dec7157845e75625b
BLAKE2b-256 481af901043134a190ee301f1539893ab3730b050310e3cbb7ff7a085a726c83

See more details on using hashes here.

Provenance

The following attestation bundles were made for markdoc_py-0.1.0.dev1.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.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for markdoc_py-0.1.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 57a1e4f3f332a190e2b774def8076f1342583fb4ee2cd6d026b0e6bafa966bcc
MD5 5f45c8bb298b404de68759b1ef9084c3
BLAKE2b-256 765b4a57355a9ca1f461c8dab3415249af5e92574fa5801d5e6270c226454d5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for markdoc_py-0.1.0.dev1-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