Search code examples
frontendmarkdowngatsbystrapi

With strapi, how to display the markdown in my gatsby frontendë


I use strapi as a CMS, and I return "rich text markdown" fields,

I can't formatë the markdown in my frontend with gatsby.

Do you have any solutions ? THANKS !

I tried modules like "react markdown" but it doesn't work with my version of gatsby which is in 2..


Solution

    • First, installing the CKEditor 5 plugin in Strapi, followed by rebuilding and restarting the Strapi app.
    • Once the app is running, navigate to the content builder in your Strapi and modify the default rich text box to CKEditor 5 rich text box (custom), adjusting the content according to your desired structure (utilizing features such as bullets, text color, and text indent).
    • In your frontend use this tag
      <div dangerouslySetInnerHTML={{ __html:content.Blog_content.data.Blog_content }}></div>

    you definetly get the format you want.this one is working for me.