Markdown Previewer
How do I make an markdown previewer?
Markdown Previewer made using React for free code camp. What is a markdown previewer? How do you make a markdown previewer? This script and codes were developed by Adam on 28 November 2022, Monday.
Markdown Previewer - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Markdown Previewer</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="root"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Markdown Previewer - Script Codes CSS Codes
body { font-family: 'Verdana', sans-serif; background: #111;
}
.container { display: flex; width: 100%; margin: 1em;
}
.input { width: 50%; height: 600px;
}
.input textarea { width: 100%; height: 100%; background: #333; border-color: orange; padding: 0.5em; color: #fff;
}
.output { width: 50%; margin-left: 3em; padding: 1em; color: #ff7505;
}
Markdown Previewer - Script Codes JS Codes
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var placeholder = 'Markdown Previewer\n======\nHeading\n=======\n\nSub-heading\n-----------\n \n### Deeper heading\n\nText attributes *italic*, **bold**, \n`monospace`, ~~strikethrough~~ .\n \nSeparate paragraphs with\nby a blank line.\n\nLeave 2 spaces at the end of a line to do a \nline break\n\nUnordered list:\n\n * Red\n * Yellow\n * Blue\n\nNumbered list:\n\n 1. Red\n 2. Yellow\n 3. Blue\n';
var App = function (_React$Component) { _inherits(App, _React$Component); function App(props) { _classCallCheck(this, App); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { input: placeholder }; return _this; } App.prototype.update = function update(e) { this.setState({ input: e.target.value }); }; App.prototype.output = function output(text) { var result = marked(text, { sanitize: true }); return { __html: result }; }; App.prototype.render = function render() { return React.createElement( "div", { className: "container" }, React.createElement( "div", { className: "input" }, React.createElement("textarea", { value: this.state.input, onChange: this.update.bind(this) }) ), React.createElement( "div", { className: "output" }, React.createElement("div", { dangerouslySetInnerHTML: this.output(this.state.input) }) ) ); }; return App;
}(React.Component);
ReactDOM.render(React.createElement(App, null), document.querySelector('#root'));
Developer | Adam |
Username | rzencoder |
Uploaded | November 28, 2022 |
Rating | 3 |
Size | 3,929 Kb |
Views | 6,072 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Scrolling Effects Practice | 6,441 Kb |
HTML Canvas Paint App | 3,477 Kb |
Wikipedia Viewer | 3,276 Kb |
Whack-a-Mole and Simon Game | 10,604 Kb |
React Betting App | 6,005 Kb |
Scatterplot Graph D3 | 5,762 Kb |
React Leaderboard | 4,333 Kb |
Random Movie Quote Generator | 3,861 Kb |
React Game of Life | 7,264 Kb |
Calculator | 4,572 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS3 iPad | Vikvarg | 1,766 Kb |
CSS Parent Selector | Tomhodgins | 2,143 Kb |
Scoreboard.js basic usage | Tbleckert | 1,733 Kb |
Font stack | Adrianjacob | 1,868 Kb |
NeeilTimer | Neeilan | 2,836 Kb |
FCC Portfolio | Cmwebby | 4,304 Kb |
SVG Circle Progress | JMChristensen | 3,368 Kb |
Box-sizing | Elad2412 | 1,572 Kb |
Android Play Store With Slick Carousel | -J0hn- | 4,982 Kb |
Bezier Animation with straight paths | Rhernando | 2,087 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!