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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <!-- Script for markdown parser -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/2.0.3/marked.min.js" integrity="sha512-t1jq1b5U4hgz4lQoeyRD9QiVu99KxjyA939fnND+R+gLOHmuT5F9YFHJI1Nse1B1QG6/U11SPAc8fshYshb6MA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<!-- Scripts for react -->
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>

<!-- Link for Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

<div id="app"></div>
<footer>
    <p>pen by Purnima Kumar &hearts;</p>
</footer>
              
            
!

CSS

              
                .editor-box {
  margin-top: 96px;
  margin-bottom: 48px;
}

.previewer-box {
  margin-bottom: 48px;
}

.heading {
  font-size: 24px;
  padding: 8px;
  background-color: #ffe3e3;
  font-weight: 700;
  text-transform: uppercase;
  border-top: 2px solid #ff6b6b;
  border-left: 2px solid #ff6b6b;
  border-right: 2px solid #ff6b6b;
  margin: 0;
}

#editor, #preview {
  width: 100%;
  padding: 10px;
  font-size: 18px;
  font-family: sans-serif;
  background-color: #ffe3e3;
  border: 2px solid #ff6b6b;
}

#editor {
  min-height: 200px;
}

#editor:focus {
  outline: none;
}

footer p {
  font-size: 18px;
  text-align: center;
  font-family: sans-serif;
}

              
            
!

JS

              
                const markdown = `# h1
## h2
[This is a link!](https://www.google.com/)

This is some inline code \`<div></div>\`

This is a code block 
\`\`\`
function temp(arg1, arg2) {
          
}
\`\`\`
This is an ordered list
1. List item 1
2. List item 2
3. List item 3
4. List item 4
5. List item 5
        
This is a unordered list
- List item 1
- List item 2
- List item 3
  - List item 3a
- List item 4
- List item 5
  - List item 5a
  - List item 5b

We can also embed images ![an image](https://source.unsplash.com/T-0EW-SEbsE)
We can also write **bold** and _italic_ text or both _**like this**_
>We can also create block quotes!`

// to allow carriage returns as <br />
marked.setOptions({
  breaks: true,
});

class MarkdownPreviewer extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: " "
    };
  }
  
  updateMarkup = (event) => {
    this.setState({
      value: event.target.value
    });
  }
  
  componentDidMount() {
    this.setState({
      value: markdown
    });
  }
    
  render() {
    return (
      <div className="container">
        <div className="editor-box">
          <h2 className="heading">Editor</h2>
          <textarea id="editor" value= {this.state.value} type="text" onChange={this.updateMarkup.bind(this)} />
        </div>
        <div className="previewer-box">
          <h2 className="heading">Previewer</h2>
          <div dangerouslySetInnerHTML = {{
              __html: marked.parse(this.state.value)
              }}
               id="preview">
            
          </div>
        </div>
      </div>
    );
  }
}

  ReactDOM.render(<MarkdownPreviewer />, document.getElementById("app"));

              
            
!
999px

Console