const initialState = `
This is a paragraph
# Heading
## Heading 2
**This is bolded text**
> Block Quotes!
- list item 1
- list item 2
- list item 3
[visit my linkedin profile](https://www.linkedin.com/in/deepak-webdev)
This is a inline \`<div></div>\`
This is a block of code:
\`\`\`
let x = 1;
let y = 2;
let z = x + y;
\`\`\`
![freecodecamp logo](https://cdn.freecodecamp.org/testable-projects-fcc/images/fcc_secondary.svg)`;
class App extends React.Component {
state = {
text: initialState,
};
handleChange = (event) => {
this.setState({
text: event.target.value,
});
};
render() {
const { text } = this.state;
const markdown = marked(text, { breaks: true });
return (
<div className="App">
<h2 className="text-center mt-4">Convert Your Markdown</h2>
<div className="container">
<div className="row">
<div className="col-6">
<h6>Enter your markdown:</h6>
<textarea
id="editor"
className="form-control p-2"
value={text}
onChange={this.handleChange}
/>
</div>
<div className="col-6">
<div
className="preview rounded"
dangerouslySetInnerHTML={{ __html: markdown }}
id="preview"
/>
</div>
</div>
</div>
</div>
);
}
}
Do you have a link to a repo or online IDE?
Also, cutting and pasting the error message so we can read all of it (not clipped) might help.
6. When my markdown previewer first loads, the default markdown in the #editor field should be rendered as HTML in the #preview element
#editor's markdown does not render correctly on window load : expected '<p>This is a paragraph</p>\n<p><strong>This is bolded text</strong></p>\n<blockquote>\n<p>Block Quotes!</p>\n</blockquote>\n<h1 id="heading">Heading</h1>\n<h2 id="heading-2">Heading 2</h2>\n<ul>\n<li>list item 1</li>\n<li>list item 2</li>\n<li>list item 3<br><a href="https://www.linkedin.com/in/deepak-webdev">visit my linkedin profile</a><br>This is a inline <code><div></div></code><br>This is a block of code:<pre><code>let x = 1;\nlet y = 2;\nlet z = x + y;\n</code></pre>\n<img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/fcc_secondary.svg" alt="freecodecamp logo"></li>\n</ul>\n' to equal '<p style="user-select: auto;">This is a paragraph</p>\n<p style="user-select: auto;"><strong style="user-select: auto;">This is bolded text</strong></p>\n<blockquote style="user-select: auto;">\n<p style="user-select: auto;">Block Quotes!</p>\n</blockquote>\n<h1 id="heading" style="user-select: auto;">Heading</h1>\n<h2 id="heading-2" style="user-select: auto;">Heading 2</h2>\n<ul style="user-select: auto;">\n<li style="user-select: auto;">list item 1</li>\n<li style="user-select: auto;">list item 2</li>\n<li style="user-select: auto;">list item 3<br style="user-select: auto;"><a href="https://www.linkedin.com/in/deepak-webdev" style="user-select: auto;">visit my linkedin profile</a><br style="user-select: auto;">This is a inline <code style="user-select: auto;"><div></div></code><br style="user-select: auto;">This is a block of code:<pre style="user-select: auto;"><code style="user-select: auto;">let x = 1;\nlet y = 2;\nlet z = x + y;\n</code></pre>\n<img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/fcc_secondary.svg" alt="freecodecamp logo" style="user-select: auto;"></li>\n</ul>\n'
AssertionError: #editor's markdown does not render correctly on window load : expected '<p>This is a paragraph</p>\n<p><strong>This is bolded text</strong></p>\n<blockquote>\n<p>Block Quotes!</p>\n</blockquote>\n<h1 id="heading">Heading</h1>\n<h2 id="heading-2">Heading 2</h2>\n<ul>\n<li>list item 1</li>\n<li>list item 2</li>\n<li>list item 3<br><a href="https://www.linkedin.com/in/deepak-webdev">visit my linkedin profile</a><br>This is a inline <code><div></div></code><br>This is a block of code:<pre><code>let x = 1;\nlet y = 2;\nlet z = x + y;\n</code></pre>\n<img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/fcc_secondary.svg" alt="freecodecamp logo"></li>\n</ul>\n' to equal '<p style="user-select: auto;">This is a paragraph</p>\n<p style="user-select: auto;"><strong style="user-select: auto;">This is bolded text</strong></p>\n<blockquote style="user-select: auto;">\n<p style="user-select: auto;">Block Quotes!</p>\n</blockquote>\n<h1 id="heading" style="user-select: auto;">Heading</h1>\n<h2 id="heading-2" style="user-select: auto;">Heading 2</h2>\n<ul style="user-select: auto;">\n<li style="user-select: auto;">list item 1</li>\n<li style="user-select: auto;">list item 2</li>\n<li style="user-select: auto;">list item 3<br style="user-select: auto;"><a href="https://www.linkedin.com/in/deepak-webdev" style="user-select: auto;">visit my linkedin profile</a><br style="user-select: auto;">This is a inline <code style="user-select: auto;"><div></div></code><br style="user-select: auto;">This is a block of code:<pre style="user-select: auto;"><code style="user-select: auto;">let x = 1;\nlet y = 2;\nlet z = x + y;\n</code></pre>\n<img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/fcc_secondary.svg" alt="freecodecamp logo" style="user-select: auto;"></li>\n</ul>\n'
at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:549:1889)
at Proxy.l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:431:130)
at Function.n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:574:655)
at a.<anonymous> (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:657:160758)
at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:38668
at i.g.run (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:38963)
at N.runTest (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:45686)
at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:46651
at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:45075)
at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:45145
at o (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:44190)
at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:44961
at f (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:593:1384)
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.