Library that generates HTML output from JSON export of tiptap editor
Project description
Tiptapy
Library that generates HTML output from JSON export of tiptap editor
This is a forked version of stckme/tiptapy by Shekhar Tiwatne. This version includes camel case support for newer tiptap versions. Please consider using the original project in your projects.
Install
pip install cfm-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>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cfm-tiptapy-0.15.3.tar.gz
(8.1 kB
view details)
File details
Details for the file cfm-tiptapy-0.15.3.tar.gz
.
File metadata
- Download URL: cfm-tiptapy-0.15.3.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c66115f595d3eb5a7a7807cf6fd38897e28367fb0287dec2fee8f13ee1f12169 |
|
MD5 | 05bc46bb81920090ef142be71208a6a4 |
|
BLAKE2b-256 | aeae8308757c6b8c06481b9c9c44cbbf5fb611709a465279d1b5b733291fd8cd |