Granted my code isn’t very pretty and doesn’t do anything super special right now (I’ll get to that when I figure out why it’s not passing) but as far as I can tell, all the tests should be passing for the markdown previewer, but only 3 of them pass. Also, why doesn’t any of the marked markup show on newlines even though I’m entering new lines?
class MarkdownApp extends React.Component {
constructor(props) {
super(props);
this.state = {
value: "# Marked - Markdown Parser\n## How To Use The Demo\n <http://www.github.com>\n `this is code`\n\t`inline code`\n blockquote\n * list\n ![image](https://www.w3schools.com/w3css/img_lights.jpg)\n __bold__"
};
this.handleKeyUp = this.handleKeyUp.bind(this);
}
handleKeyUp(event) {
this.setState({ value: event.target.value });
}
render() {
return (
<form>
<label>
Enter your markdown here:
<br />
<textarea onKeyUp={this.handleKeyUp} id='editor' />
<br />
</label>
<label>
Your markup will be previewed here:
<p id='preview'>{marked(this.state.value)}</p>
</label>
</form>
);
}
}
ReactDOM.render(
<MarkdownApp />,
document.getElementById('root')
);