Skip to main content

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

tiptapy

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>

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

tiptapy-0.17.0.tar.gz (8.9 kB view details)

Uploaded Source

File details

Details for the file tiptapy-0.17.0.tar.gz.

File metadata

  • Download URL: tiptapy-0.17.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for tiptapy-0.17.0.tar.gz
Algorithm Hash digest
SHA256 22cecb979c7387d705174668bbc3bae7aba19f803c4d0756df582bb03d07b027
MD5 47ef7719da8db99b2cd393024f6122c1
BLAKE2b-256 d30f12c0a8d5de4b383c2805732285878a224960f96cd792c71b34b396efb339

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page