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>"
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.0.tar.gz
(3.4 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.0.tar.gz.
File metadata
- Download URL: transdoc_python-0.1.0.tar.gz
- Upload date:
- Size: 3.4 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 |
b3e59c0f33c994182d5f26fa1af61769862cc76ea33a018879cefb133507dc72
|
|
| MD5 |
80947d058d55a44951d1f4a4372fa1f7
|
|
| BLAKE2b-256 |
5a27164251b902328339021ddcc468efcc389d2046aa26ff1645bd6e2e1c6f4e
|
File details
Details for the file transdoc_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: transdoc_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 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 |
3b4a0fcea4acb085d68e81e1600b4a4d9b7eeef447da5c34d5aebe5e4ce33e28
|
|
| MD5 |
be7087e1d022819cd823ad7db2b240a8
|
|
| BLAKE2b-256 |
516fae4aa793ce6e7a198e60ad23369b46975aaf4db332d0fb60d174a498ccb2
|