css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              <!--

  Markdown Previewer

  A FreeCodeCamp project

  Built with React

  By Leonardo Prates

-->
            
          
!
            
              $shadows: 10px 10px 15px #333

html,
body,
section
  height: 100vh

body
  background: #379
  padding: 25px

.jumbotron
  -webkit-box-shadow: $shadows
  -moz-box-shadow: $shadows
  box-shadow: $shadows
  margin-bottom: 50px
  border-radius: 0 !important

.row
  padding-bottom: 50px

.full-height
  height: 80vh

#markdown
  font-family: monospace
  border: none
  outline: none
  resize: none
  overflow: auto
  -webkit-box-shadow: $shadows
  -moz-box-shadow: $shadows
  box-shadow: $shadows
  padding: 25px 30px
  margin-top: 25px
  margin-bottom: 25px

#htmlArea
  background: #fff
  overflow: auto
  -webkit-box-shadow: $shadows
  -moz-box-shadow: $shadows
  box-shadow: $shadows
  padding: 1px 25px
  margin-top: 25px
  margin-bottom: 25px

footer
  color: #fff
            
          
!
            
              const Header = () => (
  <header className='jumbotron'>
    <h1 className='text-center'>
      <img src='http://coenraets.org/blog/wp-content/uploads/2014/12/react-logo.png' width='100'/>
      Markdown Previewer
    </h1>
    <hr />
  </header>
);

class Markdown extends React.Component {
  constructor() {
    super();
    this.state = {
      converter: new showdown.Converter(),
      value: `Hello, World!\n===\n---\n# This is an h1\n## This is an h2\n### This is an h3\n#### This is an h4\n##### This is an h5\n###### This is an h6`,
    };
  }

  createMarkup() {
    return {__html: this.state.converter.makeHtml(this.state.value) };
  }

  handleChange(event) {
    this.setState({ value: event.target.value });
  }

  render() {
    return (<div className='row'>
              <div className='col-sm-6'>
                <textarea
                  type='text'
                  defaultValue={this.state.value}
                  onChange={this.handleChange.bind(this)}
                  id='markdown'
                  className='col-xs-10 col-xs-offset-1 full-height'></textarea>
              </div>
              <div className='col-sm-6'>
                <div id='htmlArea'
                     className='col-xs-10 col-xs-offset-1 full-height'>
                  <div dangerouslySetInnerHTML={this.createMarkup()} />
                </div>
              </div>
            </div>);
  }
}

const Footer = () => (
  <footer className='col-xs-8 col-xs-offset-2'>
    <hr />
    <p className='text-center'>
      Markdown Previewer created by <a href='http://leonardoprates.com' target='_blank' className='text-warning'>Leonardo Prates</a>
    </p>
  </footer>
);

const App = () => (
  <div className='container-fluid'>
    <Header/>
    <Markdown/>
    <Footer/>
  </div>
);

document.write('<div id="app"></div>');
ReactDOM.render(<App/>, document.getElementById('app'));
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console