Jad S Jad S - 4 months ago 32
Markdown Question

Converting mark down content to HTML in a Django-React app

I want to store blog content in my database, which I could then display in an HTML page, ideally by sending the content over an AJAX call.
After looking through the web I've read a few people suggesting storing the blog post as markdown which makes the most sense since it contains supports headers, paragraphs and code formatting, and mark down would be the easiest way to read/write the post.

However I'm not sure how to convert the markdown to an HTML page. I'm also not sure if I want to do that conversion client side (React frontend) or server side (Django Rest Framework backend).

What are some tools or methods to get this done given my stack?


I've done something similar, but with Angular - there are plenty of projects out there to help accomplish this. React-Markdown is one of them.

From their GitHub:

var React = require('react');
var ReactDOM = require('react-dom');
var ReactMarkdown = require('react-markdown');

var input = '# This is a header\n\nAnd this is a paragraph';

    <ReactMarkdown source={input} />,