JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<div id="wrapper">
<div class="title">Markdown Previer</div>
<div id="inputField">
<form class="inputForm">
<textarea id="textField" class="form">
</textarea>
</form>
</div>
<div id="outputField"></div>
<div class="footer">Created by Sebastian Sporek</div>
</div>
* {
margin: 0;
padding: 0;
background-color: silver;
color: black;
box-sizing: border-box;
font-family: 'Lato', sans-serif;
}
#wrapper {
width:1200px;
margin: 20px auto;
}
.inputForm {
display:block;
width: 580px;
float: left;
margin-right: 20px;
}
.form {
margin: 0;
width: 100%;
padding: 10px;
border: 2px solid gray;
background-color: white;
color: black;
font-size: 16px;
outline: none;
padding: 10px;
height: 500px;
}
#outputField{
}
.outputField {
margin: 0;
width: 580px;
padding: 5px 20px;
border: 2px solid gray;
background-color: silver;
color: black;
height: 500px;
float:right;
overflow: auto;
word-wrap: break-word;
}
.outputField p {
margin: 0 0 10px;
}
.outputField ul, ol, h1, h2, h3 {
margin-bottom: 10px;
}
.outputField li {
margin-left:40px;
}
.title {
text-align: center;
font-size: 40px;
border: 2px solid gray;
padding: 10px;
margin-bottom: 10px;
}
.footer {
clear:both;
text-align: center;
color: gray;
font-size: 15px;
padding: 10px;
}
document.addEventListener("DOMContentLoaded", function(event) {
var inputField = document.getElementById('inputField');
var outputField = document.getElementById('outputField');
var textField = document.getElementById('textField');
var insertedText = "Title\n=======\nSub-heading\n-----------\n### Small subtitle\n\nParagraphs are separated by a blank line.\n\nLeave 2 spaces at the end of a line to do \na line break\n\nText attributes:\n *italic*, **bold**, `monospace`, ~~strikethrough~~ .\n\nUnordered list:\n\n * wood\n * stone\n * steel\n\nNumbered list:\n\n 1. first\n 2. second\n 3. third\n\nWhen the student is ready\nthe teacher will appear - Zen Proverb\n\n*[freeCodeCamp](https://freecodecamp.com/)*";
var textFromInput = insertedText;
marked.setOptions({
sanitize: true,
breaks: true
});
function Result() {
return (
<div className="outputField" dangerouslySetInnerHTML={{__html:marked(textFromInput)}} ></div>
)
}
textField.innerHTML = insertedText;
ReactDOM.render(<Result />,outputField);
textField.addEventListener("input", function(a){
textFromInput = a.target.value;
ReactDOM.render(<Result />,outputField);
},false);
});
Also see: Tab Triggers