stckme / tiptapy

Library that generates HTML output from JSON export of tiptap editor
MIT License
42 stars 12 forks source link

Add <code>: The Inline Code element #32

Closed Pradhvan closed 3 years ago

Pradhvan commented 4 years ago

Add code block tiptapy that converts the below JSON

{
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "marks": [
            {
              "type": "code"
            }
          ],
          "text": "PEP 20"
        },
        {
          "type": "text",
          "text": " The Zen of Python"
        }
      ]
    },
    {
      "type": "code_block",
      "content": [
        {
          "type": "text",
          "text": "import this"
        }
      ]
    }
  ]
}

to the following HTML

<p><code>PEP 20</code> The Zen of Python</p><pre><code>import this</code></pre>

The statement that generated this JSON in the editor is given below

PEP 20 The Zen of Python

import this