i seem to fail this project for days. it passes only the 3/8 from all requierments no matter what i write or 0 if i dont put the text with the heading 1, heading 2, and so on what i want to write in there to be seen in the textarea’s #editor.
html:
<div id="app">
<div class="container">
<h1>Markdown Previewer</h1>
<div class="editor">
<h2>Editor</h2>
<label for="markdown">Enter your Markdown:</label>
<textarea id="editor" name="markdown" placeholder=" type text here...">
# Heading 1\n\n## Subheading\n\nHere is a [link](https://www.example.com).\n\nHere is some `inline code`.\n\n```js\n// This is a code block\nfunction example() {\n console.log('Hello, world!');\n}\n```\n\n- List item 1\n- List item 2\n- List item 3\n\n> This is a blockquote.\n\n\n\n**Bolded text**
</textarea>
</div>
<div class="preview">
<h2>Preview</h2>
<div id="preview">
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/2.1.3/marked.min.js" integrity="sha512-5e5kjUc5F8CCBwM5udzXOi5pd3L0zQ+Tl1LJxV80z69mtdm76COW0q3TyhO9k24M5T5P7JmEGeN4UjRUwGQzHw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
js:
const editor = document.querySelector('#editor');
const preview = document.querySelector('#preview');
editor.addEventListener('input', () => {
const markdown = editor.value;
const html = marked(markdown);
preview.innerHTML = html;
});
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
markdown: `# Heading 1
## Subheading
Here is a [link](https://www.example.com).
Here is some \`inline code\`.
\`\`\`
// This is a code block
function example() {
console.log('Hello, world!');
}
\`\`\`
- List item 1
- List item 2
- List item 3
> This is a blockquote.

**Bolded text**`
};
marked.setOptions({
gfm: true,
breaks: true
});
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
this.setState({
markdown: event.target.value
});
}
render() {
return (
<div>
<Editor markdown={this.state.markdown} handleChange={this.handleChange} />
<Previewer markdown={this.state.markdown} />
</div>
);
}
}
im using codepen .tried to write a different react code …still not passing anything.i thought its my editor not working correctly,so i tried to check some other markdown code and copy them to see if they pass in my editor(the projects were ones that passed all 8 steps from thr respective users).its not working…now im here to ask for some help to pass this project.maybe my code after all its wrong .should i add something.to delete something maybe …help please