How to render QuillJS rich-text output to HTML

Tony picture Tony · Sep 29, 2016 · Viewed 16k times · Source

I am a little stuck, I am working with Quill JS editor and have now got to the point where I need to render the output from the editor in a html document and possibly a PDF document (HTML is a priority)

How would I render output like this:

{
  "ops": [
    {"attributes":{"bold":true},"insert":"Test Post"},
    {"insert":"\n\nThis is a test post.\n"}
  ]
}

I have had a look around but cant seem to find out how to do this. I hope someone can help.

Thanks!

Answer

Keno picture Keno · Oct 16, 2016
editor.root.innerHTML

You will need to style it.

From there you can export to PDF with something like jsPDF or similar or bounce it to the server.

Example:

Getting Quill content