Is there any simple way to convert markdown text from contentful api to render into html code to be display on html page. I have tried using pagedown and some similar techniques
Here's how I did it with React:
class NewsDetail extends React.Component {
render() {
const body = marked(this.props.body || "");
return (
{this.props.title}
);
}
}
The markdown content is stored in the body attribute of the NewsDetail
tag (via a short function that maps contentful data structure to my app structure).
The HTML page has this script tag to pull in the marked
function: