Markdown preview

Developer
Size
3,250 Kb
Views
28,336

How do I make an markdown preview?

In progress.. What is a markdown preview? How do you make a markdown preview? This script and codes were developed by Kevin on 20 August 2022, Saturday.

Markdown preview Previews

Markdown preview - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Markdown preview</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="app"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Markdown preview - Script Codes CSS Codes

.flex-center { display: flex; flex-direction: row; justify-content: center;
}
textarea,
.container { box-sizing: border-box; width: 500px; max-width: 100%; height: 500px;
}
textarea { padding: 15px;
}
.container { padding: 0 15px 15px 15px;
}

Markdown preview - Script Codes JS Codes

"use strict";
var Markdown = React.createClass({ displayName: "Markdown", markedDown: function markedDown() { console.log(this.props.text); return { __html: marked(this.props.text) }; }, render: function render() { return React.createElement( "div", { className: "container" }, React.createElement("div", { dangerouslySetInnerHTML: this.markedDown() }) ); }
});
var TextInput = React.createClass({ displayName: "TextInput", getInitialState: function getInitialState() { return { text: "Hashtags determine a heading size, # will create an h1 element, and ## will create an h2, etc.\n\n# I am the mighty H1!\n###### I may be small, but i'm still a heading element!\n\nParagraphs are created by adding spaces between lines. That means this is a p element.\n\nAnd so is this.\n\nIf you want a line break, just add two spaces at the end of the line.\nNotice how this is still on the same line in the markdown preview? That's because there are no additional spaces.\n\nThere are two spaces at the end of this line. \nSo this line has a break element before it.\n\n1. Seven\n2. Reasons\n3. Numbered\n4. Lists\n5. Are\n6. Self\n7. Explanatory" }; }, handleChange: function handleChange(e) { return this.setState({ text: e.target.value }); }, render: function render() { return React.createElement( "div", { className: "flex-center" }, React.createElement( "textarea", { value: this.state.value, onChange: this.handleChange }, this.state.text ), React.createElement(Markdown, { text: this.state.text }) ); }
});
ReactDOM.render(React.createElement(TextInput, null), document.getElementById('app'));
Markdown preview - Script Codes
Markdown preview - Script Codes
Home Page Home
Developer Kevin
Username KevinBruland
Uploaded August 20, 2022
Rating 3
Size 3,250 Kb
Views 28,336
Do you need developer help for 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!

Kevin (KevinBruland) 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!