A Transdoc handler for Python docstrings
Project description
🏳️⚧️🐍 Transdoc Python
A Transdoc handler for Python docstrings.
Installation
pip install transdoc[python]
Usage
Transdoc rules are applied to Python docstrings.
For example, given the following rule:
def mdn_link(e: str) -> str:
'''
Return a Markdown-formatted link to MDN's documentation of an HTML element.
'''
return (
f"[View `<{e}>` on MDN]"
f"(https://developer.mozilla.org/en-US/docs/Web/HTML/Element/{e})"
)
The following Python function's docstring would be transformed as follows:
# Before
def make_link(text: str, href: str) -> str:
'''
Generate an HTML link.
{{mdn_link[a]}}
'''
# Please don't write code this insecure in real life
return f"<a href={href}>{text}</a>"
# After
def make_link(text: str, href: str) -> str:
'''
Generate an HTML link.
[View `<a>` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
'''
# Please don't write code this insecure in real life
return f"<a href={href}>{text}</a>"
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
transdoc_python-0.1.1.tar.gz
(3.5 kB
view details)
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 transdoc_python-0.1.1.tar.gz.
File metadata
- Download URL: transdoc_python-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ac392bdcbcb73af4de713ffe7965f12e7e257098908cba2695f5c6914848c5d
|
|
| MD5 |
fe1f066a9efa5b8acbc58192ac7090fc
|
|
| BLAKE2b-256 |
01973edff18dddfcbf3b4907be488d54cb3dc5bbe863691767666080c1b0b55f
|
File details
Details for the file transdoc_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: transdoc_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82f4b8ec489b2f2a57ed9326a16603c6b869ba2fd5a34b1a3c9348fcc4d05cc8
|
|
| MD5 |
4e5864fe50b66ada69637a0c23b0fb28
|
|
| BLAKE2b-256 |
7f5f8468cfb13fc9081f6c6cc67cb170ea92b22618a4cedb01a3fade11f98c63
|