A CJK-friendly AsciiDoc parser for Python, built on markdown-it-py.
Project description
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), barehttps://x(auto-detected, trailing punctuation trimmed),link:target[text](any target) - Images: block
image::target[alt], inlineimage: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">).nameis not interpreted — it becomes the CSS class verbatim, so meaning lives in the document's own stylesheet, not in pyasciidoc
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.
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyasciidoc-0.4.0.tar.gz.
File metadata
- Download URL: pyasciidoc-0.4.0.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3c47f89d9baf966897a5a4827f98106ffbc3569d2cb519f7a1c40e513771d8c
|
|
| MD5 |
e40f712ee0411b0a9632f065b7ea2225
|
|
| BLAKE2b-256 |
b41871529c9e5e5317b6430c8b9b1a10e14842d1874892755c01ddcc8dc6a777
|
Provenance
The following attestation bundles were made for pyasciidoc-0.4.0.tar.gz:
Publisher:
publish.yml on aiseed-dev/pyasciidoc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyasciidoc-0.4.0.tar.gz -
Subject digest:
a3c47f89d9baf966897a5a4827f98106ffbc3569d2cb519f7a1c40e513771d8c - Sigstore transparency entry: 2161913335
- Sigstore integration time:
-
Permalink:
aiseed-dev/pyasciidoc@f5da25bb82dd2e7bde87d38dad79c9b8023e156b -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/aiseed-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f5da25bb82dd2e7bde87d38dad79c9b8023e156b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyasciidoc-0.4.0-py3-none-any.whl.
File metadata
- Download URL: pyasciidoc-0.4.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2806ac747fbab4c3c288c7efbf13babcb07e571de9e9f01f9ae73a6b3834b103
|
|
| MD5 |
b2482420077b12f2ad340432082679b0
|
|
| BLAKE2b-256 |
fd514dd6a43cb7e388ff52a3018f16201775fc57e20f7a569f687c58f1a69d6f
|
Provenance
The following attestation bundles were made for pyasciidoc-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on aiseed-dev/pyasciidoc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyasciidoc-0.4.0-py3-none-any.whl -
Subject digest:
2806ac747fbab4c3c288c7efbf13babcb07e571de9e9f01f9ae73a6b3834b103 - Sigstore transparency entry: 2161913506
- Sigstore integration time:
-
Permalink:
aiseed-dev/pyasciidoc@f5da25bb82dd2e7bde87d38dad79c9b8023e156b -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/aiseed-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f5da25bb82dd2e7bde87d38dad79c9b8023e156b -
Trigger Event:
push
-
Statement type: