Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

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.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link href="https://fonts.googleapis.com/css?family=Turret+Road&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Chelsea+Market&display=swap" rel="stylesheet">
<h1 id="top-title"><span id="react">React</span> Markdown Previewer</h1>
<div id="app"></div>


              
            
!

CSS

              
                body {
  display: grid;
  align-content: center;
  justify-content: center;
  background: #4f4f4f;
}

#top-title {
  //position: absolute;
  width: 100%;
  text-align: center;
  font-family: "Chelsea Market", cursive;
  color: #fff;
  //background: #444;
  //margin: 0;
  margin-bottom: -40px;
  //margin-top: 40;
  z-index: 50;
}

h2 {
  margin-bottom: 0;
}

#react {
  color: #79d8f8;
}

#container {
  margin-top: 40px;
  width: 90vw;
  max-width: 800px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#textareacontainer {
  width: 50%;
  text-align: center;
  display: table-cell;
}

#textareatitle {
  height: 6vh;
  font-size: 15px;
  text-decoration: underline;
  color: #fff;
}

#textarea {
  display: flex;
  height: 100vh;
  margin: 5px;
}

#textarea textarea {
  width: 100%;
  background: #020204;
  color: #22b455;
  border: 4px outset #888;
  border-radius: 5px;
  padding: 2vh;
  font-family: "Turret Road", cursive;
  font-size: 12px;
  height: 100%;
}

#previewcontainer {
  width: 50%;
  text-align: center;
  display: table-cell;
  height: 100vh;
}

#previewtitle {
  height: 6vh;
  font-size: 15px;
  text-decoration: underline;
  color: #fff;
}

#preview {
  text-align: left;
  border: 4px outset #888;
  border-radius: 5px;
  padding: 2vh;
  margin: 5px;
  font-family: "Montserrat", sans-serif;
  height: 100vh;
  overflow: scroll;
  background: #efefef;
}
#preview > h1 {
  margin: 0;
}

img {
  width: 100%;
}

code {
  font-family: Monaco, monospace;
  background-color: #ddd;
}

blockquote {
  background: #f9f9f9;
  border-left: 10px solid #aaa;
  margin: 1.5em 10px;
  padding: 0.5em 10px;
  quotes: "\201C""\201D""\2018""\2019";
}
blockquote:before {
  color: #aaa;
  content: open-quote;
  font-size: 4em;
  line-height: 0.1em;
  margin-right: 0.25em;
  vertical-align: -0.4em;
}
blockquote p {
  display: inline;
}

              
            
!

JS

              
                class App extends React.Component {
  constructor() {
    super();
    this.state = {
      count: 0,
      text: `# This is a header 
## This is a subheader
[This is a link (to google)](https://www.google.com)

**This is bolded text**

\`This is inline code\`

\`\`\`
This is a code block 
and another line of the code block
\`\`\`

- This is an unordered list item 
- This is another unordered list item
- This is a final unordered list item 

1. This is an ordered list item
2. This is another ordered list item
3. This is a final ordered list item

> This is a blockquote. If you type a lot of things, it will still wrap properly, which makes it awesome! 

![Image of Yaktocat](https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1024px-React-icon.svg.png)
`
    };
  }
  
  updateText(event) {
        this.setState({text: event.target.value})
    }  
  //Change the above with parsed markdown stuff
 

  render() {
    return (<div id="container">
        <div id="textareacontainer">
          <div id="textareatitle">
          <h2>Text Editor</h2>
           </div>
          <div id="textarea">
        <textarea id="editor" onChange={this.updateText.bind(this)} value={this.state.text}></textarea>
        </div>
          </div>
   <div id="previewcontainer">
     <div id="previewtitle">
          <h2>Preview</h2>
       </div>
        <div id="preview" dangerouslySetInnerHTML={this.toMarkdown()} />
        </div>
        </div>
      
           );
  }
  
  toMarkdown() {
    var preMarkup = marked(this.state.text, {sanitize: true});
    return { __html: preMarkup };
  }
  
 
}


React.render(<App />, document.getElementById('app'));

              
            
!
999px

Console