Skip to content
/ tiptapy Public

Library that generates HTML output from JSON export of tiptap editor

License

Notifications You must be signed in to change notification settings

stckme/tiptapy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

rajatsinglaRajat Singla
and
Rajat Singla
Jun 14, 2024
f34ed35 · Jun 14, 2024
Apr 2, 2022
Jun 14, 2024
Jun 14, 2024
Apr 19, 2020
Jul 18, 2022
Apr 4, 2020
Jun 14, 2024
Mar 14, 2023
Dec 20, 2019
Jul 18, 2022
Jan 17, 2020
Jul 18, 2022
Apr 24, 2020
Jun 14, 2024
Jun 14, 2024

Repository files navigation

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>

About

Library that generates HTML output from JSON export of tiptap editor

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published