contentful api markdown conversion to HTML

后端 未结 5 1996
滥情空心
滥情空心 2021-02-19 05:37

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

5条回答
  •  青春惊慌失措
    2021-02-19 05:55

    I also did the same as margarita in a react app but in the child component and I pulled my markdown from contentful.

    I installed react-markdown package

    with

    npm install react-markdown

    import React from "react";
    import ReactMarkdown from "react-markdown";
    
    const AboutIntro = (props) => {
        return (
            

    {props.aboutTitle}

    {props.aboutCopy}
    ) } export default AboutIntro;

    hope this helps

提交回复
热议问题