nadar / quill-delta-parser

A PHP library to parse and render Quill WYSIWYG Deltas into HTML - Flexibel and extendible for custom elements.
MIT License
122 stars 20 forks source link

Codeblocks doesn't render #49

Closed boring-dragon closed 3 years ago

boring-dragon commented 3 years ago

Data before rendering

{"ops": [{"insert": "for (int i = 7000000; i < 7999999; i++) { Console.WriteLine(\"Number: +960 \" + i); StringBuilder sb = new StringBuilder(); sb.AppendFormat(\"\\n{0},{1}\", \"Name\", i); File.AppendAllText(\"Dhiraagu.csv\", sb.ToString()); }"}, {"insert": "\n", "attributes": {"code-block": true}}]}

Data after rendering

<p> for (int i = 7000000; i &lt; 7999999; i++) {</p><p>      DisplayName = String.valueOf(i);</p><p>      MobileNumber = &quot;960&quot;+String.valueOf(i);</p><p>      ArrayList&lt;ContentProviderOperation&gt; ops = new ArrayList&lt;ContentProviderOperation&gt;();</p><p>      ops.add(ContentProviderOperation.newInsert(</p><p>          ContactsContract.RawContacts.CONTENT_URI)</p><p>          .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)</p><p>          .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)</p><p>          .build());</p><p>      //------------------------------------------------------ Names</p><p>      if (DisplayName != null) {</p>

Code blocks not rendering correctly. <p> tag is being used to render it

nadar commented 3 years ago

the code block listener does not exists, yet (https://github.com/nadar/quill-delta-parser/tree/master/src/listener) i will add it tomorrow if there is not any unexpected behavior.

nadar commented 3 years ago

@boring-dragon what would you expect as output html? <code>..</code>? I often see <pre><code>...</code></pre>

boring-dragon commented 3 years ago

@nadar Yes the second one you mentioned.. Almost all code snippet i see have it like this <pre><code>...</code></pre>

nadar commented 3 years ago

Version 2.7.0 released => https://github.com/nadar/quill-delta-parser/releases/tag/2.7.0