Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <body>
  <div id='root'></div>
</body>
              
            
!

CSS

              
                body {
    background-color: #6a7b8d;
  font-family: Roboto, sans-serif;
}
.container {
  display: grid;
  grid-template-columns: 50% 50%;
  margin-top: 3em;
  grid-gap: 1.5em;

}

.left{
 width: 40vw;
 height: 80vh;
  border: 1px solid white;
      box-shadow: 0 0 6px 2px #555;
}


.right {
  width: 45vw;
    height: 80vh;
    border: 1px solid black;
  overflow: auto;
      box-shadow: 0 0 6px 2px #555;
}
.right::-webkit-scrollbar {
  width: 3px;
}
.right::-webkit-scrollbar-track {
  background: #ddd;
}
.right::-webkit-scrollbar-thumb {
  background: #aaa;
}

#editor {
width: 100%;
height: 100%;
 padding: 1em;
    background-color: #272d33;
  color: #f7f7f7;
}
#editor::-webkit-scrollbar {
  width: 3px;
}
#editor::-webkit-scrollbar-track {
  background: #ddd;
}
#editor::-webkit-scrollbar-thumb {
  background: #aaa;
}


#preview{
  padding: 1em;
  background-color: #c3cad1;
}


#preview img {
  max-width: 150px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
              
            
!

JS

              
                const initialMarkdown = `
### **Welcome to the Markdown Previewer of the Day!**
___
**Text Decoration Types:**
*Italic*
**Bold**
***Bold & Italic***
___
# h1 Header
## h2 Sub-header 
### h3 Sub-Header
___
**List & Sublist items:**
- Sheets
- Pillows
- Duvets
 - Girlfriend
 - Dog
 - Cat
___

**A link:** [Visit FCC My Site](http://www.easterbrook.at/webdev/webdev.html)
___

**Block Quote of the Day:** 
> "Everybody has to be somewhere!" *Stan Laurel* 
___

**Inline code looks like this:** \`<body></body>\`

**This is a block of code:** 
\`\`\`
var x, y;
x = 5 + 6;
y = x * 10;
\`\`\`
___
**This is a table:** 

| Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |
___

**This is a task-list:** 

 - [x] Write the press release
 - [ ] Update the website
 - [ ] Contact the media
 ___

**Image of the Day:**
![FCC style="width: 70px;"](https://user-images.githubusercontent.com/59874288/80891808-c5502a80-8cc6-11ea-9762-678b6d05840d.png)
`



var renderer = new marked.Renderer()

renderer.link = function(href, title, text) {
  return `<a href=${href} target="_blank">${text}</a>`
}
marked.setOptions({
  breaks: true
})

class App extends React.Component {
  constructor(props) {
    super(props)
    
    this.state = {
      markdown: initialMarkdown
    }
  }
  
  handleChange = e => this.setState({ markdown: e.target.value })
  render() {
    return (
      <div>
    <h1 className="text-center my-4 pb-4 align-middle shadow">FCC Markdown Previewer</h1>
   
        <div className='container'>
        <div className='left'>
          <textarea id="editor" value={this.state.markdown} onChange={this.handleChange} />
      </div>
          <div className="right">
            <div id="preview" dangerouslySetInnerHTML={{__html: marked(this.state.markdown)}} />
      </div>
    </div>
</div>            
    )
  }
}

ReactDOM.render(<App/>, document.getElementById("root"))
              
            
!
999px

Console