React Markdown Preview

Developer
Size
2,675 Kb
Views
10,120

How do I make an react markdown preview?

Simple Markdown parser using the marked library. What is a react markdown preview? How do you make a react markdown preview? This script and codes were developed by Mihkel on 08 December 2022, Thursday.

React Markdown Preview Previews

React Markdown Preview - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>React Markdown Preview</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
</head>
<body> <div id="main"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

React Markdown Preview - Script Codes JS Codes

"use strict";
var Output = React.createClass({	displayName: "Output",	getInitialState: function getInitialState() {	return { value: "" };	},	markUp: function markUp() {	return { __html: marked(this.state.value, { sanitize: true }) };	},	render: function render() {	var style = {	"wordBreak": "break-all",	"wordWrap": "break-word"	};	return React.createElement(	"div",	{ className: "col-xs-6" },	React.createElement(	"h3",	null,	"Output"	),	React.createElement("div", { style: style, dangerouslySetInnerHTML: this.markUp() })	);	}
});
var Input = React.createClass({	displayName: "Input",	getInitialState: function getInitialState() {	return { value: "" };	},	onChange: function onChange(e) {	this.setState({ value: e.target.value });	this.refs.output.setState({ value: e.target.value });	},	render: function render() {	var style = {	resize: "none"	};	return React.createElement(	"div",	null,	React.createElement(	"div",	{ className: "col-xs-6" },	React.createElement(	"h3",	null,	"Input"	),	React.createElement("textarea", { rows: "20", className: "form-control", style: style, defaultValue: this.state.value, onChange: this.onChange })	),	React.createElement(Output, { ref: "output" })	);	}
});
var Container = React.createClass({	displayName: "Container",	render: function render() {	document.body.style.background = "#EEE";	return React.createElement(	"div",	{ className: "container" },	React.createElement(	"div",	{ className: "col-sm-12" },	React.createElement(Input, null)	)	);	}
});
ReactDOM.render(React.createElement(Container, null), document.getElementById("main"));
React Markdown Preview - Script Codes
React Markdown Preview - Script Codes
Home Page Home
Developer Mihkel
Username Krokodill
Uploaded December 08, 2022
Rating 3
Size 2,675 Kb
Views 10,120
Do you need developer help for React Markdown Preview?

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!

Mihkel (Krokodill) Script Codes
Create amazing Facebook ads with AI!

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!