App.jsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import React, { useState } from "react"; import { Container, Row, Col, Form } from "react-bootstrap"; import ReactMarkdown from "react-markdown"; // This is the main library for rendering markdown import "bootstrap/dist/css/bootstrap.min.css"; // Markdown Previewer App const App = () => { const [markdown, setMarkdown] = useState(""); const handleMarkdownChange = (event) => { setMarkdown(event.target.value); }; return ( <Container className="my-4"> <h1 className="text-center">Markdown Previewer</h1> <Row> {/* Input Area */} <Col md={6}> <h5>Markdown Input</h5> <Form.Control as="textarea" rows={10} value={markdown} onChange={handleMarkdownChange} /> </Col> {/* Output Area */} <Col md={6}> <h5>Preview</h5> <div className="markdown-preview"> <ReactMarkdown>{markdown}</ReactMarkdown> </div> </Col> </Row> </Container> ); }; export default App; |