Tiptapy
Library that generates HTML output from JSON export of tiptap editor
Install
pip install tiptapy
Test
python -m pytest
Usage
import tiptapy
s = """
{
"type": "doc",
"content": [
{
"type": "blockquote",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Readability counts."
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"marks": [
{
"type": "link",
"attrs": { "href": "https://en.wikipedia.org/wiki/Zen_of_Python" }
}
],
"text": "Zen of Python"
},
{
"type": "text", "text": " By "
},
{
"type": "text",
"marks": [
{
"type": "bold"
}
],
"text": "Tom Peters"
}
]
}
]
}
]
}
"""
class config:
"""
Config class to store constants used by the other nodes.
"""
DOMAIN = "python.org"
renderer = tiptapy.BaseDoc(config)
out = renderer.render(s)
print(out)
Output
<blockquote>
<p>Readability counts.</p>
<p>
<a href="https://en.wikipedia.org/wiki/Zen_of_Python">Zen of Python</a> By
<strong>Tom Peters</strong>
</p>
</blockquote>
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tiptapy-0.21.0.tar.gz
(9.5 kB
view details)
File details
Details for the file tiptapy-0.21.0.tar.gz.
File metadata
- Download URL: tiptapy-0.21.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b99555d565ef142ec05124bae652df2a03674afb2512ee98bb272693c93abf6
|
|
| MD5 |
f045755ff7affe2794ffc3938e3adcd5
|
|
| BLAKE2b-256 |
a186909f72764c799e2e2da664af84954d22bc70002fd615f42c350acdb037d6
|