Real-time Markdown Editor with Custom Blocks
Modern web applications frequently require users to input and display rich text content. Building a robust rich text editor from scratch can be complex, involving intricate state management, DOM manipulation, and parsing. This problem focuses on the core mechanics of translating user-friendly markdown input into a visually appealing, structured preview, including support for custom content blocks that go beyond standard markdown. This capability is crucial for tools like documentation platforms, content management systems, or internal knowledge bases.
Your task is to build a simple, real-time markdown editor component with a live preview.
textarea where users can type markdown.**your text** should render as <strong>your text</strong>.*your text* should render as <em>your text</em>.# Heading 1 and ## Heading 2 should render as <h1>Heading 1</h1> and <h2>Heading 2</h2> respectively.[NOTE] and [/NOTE] tags should be rendered inside a div with a specific class note-block.
[NOTE] This is an important note. [/NOTE] should render as <div class="note-block">This is an important note.</div>.[NOTE] block should also be parsed for basic inline markdown (bold/italic). Headings are out of scope inside a note block.textarea.textarea for input on the left and a preview area on the right.textarea should be large enough to comfortably type several lines of text.note-block, h1, h2, strong, em should be applied to make them visually distinct. Minimal styling is acceptable, focus on functionality.textarea correctly captures user input.**bold** and *italic* syntax are correctly parsed and rendered as <strong> and <em>.# Heading 1 and ## Heading 2 are correctly parsed and rendered as <h1> and <h2>.[NOTE]...[/NOTE] block is correctly identified and rendered as a <div class="note-block">.[NOTE] block content.Constraints
marked.js, react-markdown) are allowed. You must implement the parsing logic yourself using native JavaScript features (e.g., string methods, regular expressions).useState, useEffect), and rendering strategies.Loading editor...