Skip to main content

pyasciidoc

A CJK-friendly AsciiDoc parser for Python, built on markdown-it-py.

Why

Existing Python AsciiDoc implementations (asciidoc, asciidoc3) are ports of the original ASCII-oriented AsciiDoc.py. A quick smoke test shows they fail to recognize emphasis next to Japanese/Chinese/Korean text — *太字*と_斜体_のテスト文です renders as literal, unconverted asterisks/underscores. This is the same class of problem mdit-py-cjk-friendly solves for CommonMark.

Rather than patch a large, legacy, ASCII-oriented codebase for CJK boundary rules, pyasciidoc builds AsciiDoc's syntax as markdown-it-py rules, reusing its CJK-aware delimiter scanning directly.

Scope

v0 is intentionally small and grows by golden-fixture-driven increments (the same discipline used in mdit-py-cjk-friendly and pywashi):

  • Document/section headings: = Title .. ====== h6
  • Constrained emphasis: *strong*, _em_
  • Comments: // line comment, //// block comment (dropped entirely)
  • Admonitions: NOTE:/TIP:/IMPORTANT:/WARNING:/CAUTION: paragraphs, or delimited blocks ([NOTE] + ==== ... ====) for multi-paragraph content — real-world documents need annotations, not just prose (added after pyasciidoc started being used for actual organizational docs in aiseed-migration-kit)
  • Single-level lists: * item/- item (unordered), . item (ordered, AsciiDoc's bare-dot form)
  • Links: https://x[text] (bracketed), bare https://x (auto-detected, trailing punctuation trimmed), link:target[text] (any target)
  • Images: block image::target[alt], inline image:target[alt]
  • Tables: |=== ... |===, first row is the header
  • Quote blocks: [quote, author, source] + ____ ... ____ (attribution optional), or bare ____ ... ____
  • Footnotes: footnote:[text] — collected into a list at the end of the document
  • Roles: block [.name] applied to the following paragraph (<div class="name">), inline [.name]#text# (<span class="name">). name is not interpreted — it becomes the CSS class verbatim, so meaning lives in the document's own stylesheet, not in pyasciidoc
  • Listing/literal blocks: ---- ... ----, rendered verbatim (<pre><code>...</code></pre>) with no inline parsing — for code examples containing */_/: that would otherwise be misread as emphasis or a URL/footnote/link macro

CommonMark's own [text](url), ![alt](src), and <autolink> are disabled — they aren't AsciiDoc syntax, and their label-scanning machinery (parseLinkLabel/skipToken) was the entry point for a hang in 0.4.0 when a document contained a keyword like https/link/image/ footnote immediately before [ (see CHANGELOG 0.4.1). Backticks (`code`, which happens to match AsciiDoc's own constrained-monospace syntax) and HTML entities (&amp;) are kept as an intentional hybrid.

Added in response to real migration needs — see docs/request-website-articles.md for the request and its rationale (measured demand from a 385-article corpus).

Not yet implemented: unconstrained emphasis (**mid-word**), nested lists, cell-spanning tables, include, cross-references, indexes, and inline parsing inside emphasis (e.g. *a link[https://x] inside bold* renders the macro literally — _make_emphasis_rule pushes its content as raw text).

Usage

from pyasciidoc import render

render("= 表題\n\nこれは*重要*です。\n")
# '<h1>表題</h1>\n<p>これは<strong>重要</strong>です。</p>\n'

render("NOTE: これは*重要な*注記です。\n")
# '<div class="admonition note">\n<p class="admonition-label">NOTE</p>\n
#  <p>これは<strong>重要な</strong>注記です。</p>\n</div>\n'

License

MIT

Release files for pyasciidoc 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyasciidoc 0.5.0
File Size Uploaded
pyasciidoc-0.5.0.tar.gz 36.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyasciidoc 0.5.0
File Interpreter ABI Platform
pyasciidoc-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.0 kB

Release files / pyasciidoc-0.5.0.tar.gz

Download URL pyasciidoc-0.5.0.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
704328220a905d12f7661172f8ac1785669fa029da8af9ee37c39598a3e4978f
BLAKE2b-256 checksum
How to use checksums
ce05f6792608c8bf76e587f912fd6faee2cf4b3b3c8922d854abd1b851c2d57b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

Release files / pyasciidoc-0.5.0-py3-none-any.whl

Download URL pyasciidoc-0.5.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
502d6654e6f64bf154a46079ba988d9ba569f56a3508fb4fbbd04589daa2e431
BLAKE2b-256 checksum
How to use checksums
0602bd48842ddd976a2c0d74b0fa0174a1e137914c591eef60a2aa2022f2ca9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page