- Markdown previewer is an app that allows users to write GitHub flavored markdown into an editor, and to preview it instantly on the Previewer(output).
- The editor is a controlled input by the
useStatehook that updates its value as the writer is typing. - The GitHub flavored markdown is parsed using the 'react-marked'. The option
breakhas been set to true withmarked.setOptions(), so the markdown previewer interprets carriage returns and renders them asbrelements. - The main challenge on this project was to find out about
dangerouslySetInnerHTMLto render the raw HTML, we get from marked, properly. Without it, the text or content coming from the marked will be just a string, but when we usedangerouslySetInnerHTMLReact becomes aware of the HTML tags and renders them properly.
- First, use
npm installto install all the dependencies. - Start the devolopment server
npm start. - For more information please refer to react-app