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.4.tar.gz
(3.8 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.4.tar.gz.
File metadata
- Download URL: transdoc_python-0.1.4.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b57710eb445e81a2484afc39bf7ab639ebe36bed37b19f551434e4354ca20590
|
|
| MD5 |
21ef621319ba0e617dbf87d8df00361d
|
|
| BLAKE2b-256 |
c2ed7ea5b1dbc60c5208c23bea91af5c8e012528d6742def9e46775161b671e8
|
File details
Details for the file transdoc_python-0.1.4-py3-none-any.whl.
File metadata
- Download URL: transdoc_python-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ca4f89f37a1b7e7f967c3de803003228f24e0a636b83d6a6977f6c245e865e
|
|
| MD5 |
f8dd31605a0f198b79cff768576b618b
|
|
| BLAKE2b-256 |
6e963260b5841ec967dac69a5dda7412cd674a3f150573b47c5c63918dc02289
|