timtbdev / Next.js-Blog-App

✨ Multi-User, Full-stack blogging application built with Next.js and Supabase.
https://ink.mn
323 stars 57 forks source link

How content is rendered? #13

Open Chandraprakash-Darji opened 4 months ago

Chandraprakash-Darji commented 4 months ago

I was going through the code. When you create the post you save the editor.getJSON() to the supabase.

But you directly rendering the JSON according to code

 <div className="relative mx-auto max-w-3xl border-slate-500/50 py-5">
      <div
            className="lg:prose-md prose"
           dangerouslySetInnerHTML={{ __html: post.content || "" }}
      />
</div>

How it is working?

1337Impact commented 4 months ago

i was wondering about the same thing. i save the content as text in db and when I load it, it shows as a big json object that has the same data of the post that I've created but with no parsing of formatting.