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

              
                <a href="#" id="raw-switch" class="raw-switch">Raw: <span></span></a>
<aside id="markdown" contenteditable>
Is this an alternative h1?
=================
  
It sure is, and this is an alternative h2 syntax
---------------------------------------
  
# hi1
## hi2
### hi3
#### hi4
  
hi how are ya? just adding a bit of [multiline text](https://google.com?q=multiline%20text "Google homepage") with a title for the link. And a [link](https://google.com) without to see how it works out in the parser ya know.
  
##### hi5
  
> een quite for your pleasure just one question, is it multiline? Yes it sure is sir
  
###### hi6
  
Okay so that seems to all work fine, how about some other stuff like *italic* text and using an alternative _italic_ text syntax to make it look more classic and give it a bit of an italian look.
  
And some **bold** text to make it stronger and stuff.
  
![Placehold.it 200x200 image](http://placehold.it/200x200)
  
Or **_bold and italic_** just like that
  
And what about bold with a __alternative syntax__.
  
Oh and hey when we're at it why not add some ~~striked through~~ text as well right?
  
## Just other stuff

But what about some lists?
  
* Bananas
* Apples
* Grapefruits
* Oranges
  
And with some numberssss
  
1. Star Trek
2. Good Fellas
3. Star Wars
4. Legally Blond
  
How about *some* **yeah** or **oh YEAH!**
  
#### Finding new YEAH's!
  
```language-js
ws.getMonkeys(race, type, callback);
```
  
And what about some more **bold** and *italic* text then, maybe also some ~~striked through text~~?
  
### What about some code?
  
Gotta love some inline `{}` objects and other code like `window.getMonkeys`.

#### Single lined
  
1. hi dude
2. how are ya?

* u good?
* yeah right?
  
But I mean how awesome are **cats** though with their *furry* fur and everything?
Pretty awesome right?
</aside>
<section id="output-html"></section>
              
            
!

CSS

              
                $base-color: #444;
$grey: #f1f1f1;

$padding-m: 40px 80px;


* {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

html,body {
  height: 100%;
  margin: 0;
}

body {
  font: 300 16px 'Cousine';
  color: $base-color;
  line-height: 1.5em;
}

.raw-switch {
  font-size: .9em;
  color: $base-color;
  position: fixed;
  top: 20px;
  left: 40px;
  z-index: 1;
}

aside,section {
  width: 50%;
  padding: $padding-m;
}

aside {
  background: $grey;
  
  white-space: pre-wrap;
  
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  
  overflow-y: scroll;
  
  float: left;
  
  &:focus {
    outline: none;
  }
}

section {
  height: 100%;
  margin-left: 50%;
  
  overflow-y: scroll;
  overflow-x: hidden;
  
  h1 {
    font-size: 1.8em;
  }
  
  b {
    font-weight: 700;
  }
  
  pre {
    overflow-y: scroll;
  }
}
              
            
!

JS

              
                function parseMd(md){
  
  //ul
  md = md.replace(/^\s*\n\*/gm, '<ul>\n*');
  md = md.replace(/^(\*.+)\s*\n([^\*])/gm, '$1\n</ul>\n\n$2');
  md = md.replace(/^\*(.+)/gm, '<li>$1</li>');
  
  //ol
  md = md.replace(/^\s*\n\d\./gm, '<ol>\n1.');
  md = md.replace(/^(\d\..+)\s*\n([^\d\.])/gm, '$1\n</ol>\n\n$2');
  md = md.replace(/^\d\.(.+)/gm, '<li>$1</li>');
  
  //blockquote
  md = md.replace(/^\>(.+)/gm, '<blockquote>$1</blockquote>');
  
  //h
  md = md.replace(/[\#]{6}(.+)/g, '<h6>$1</h6>');
  md = md.replace(/[\#]{5}(.+)/g, '<h5>$1</h5>');
  md = md.replace(/[\#]{4}(.+)/g, '<h4>$1</h4>');
  md = md.replace(/[\#]{3}(.+)/g, '<h3>$1</h3>');
  md = md.replace(/[\#]{2}(.+)/g, '<h2>$1</h2>');
  md = md.replace(/[\#]{1}(.+)/g, '<h1>$1</h1>');
  
  //alt h
  md = md.replace(/^(.+)\n\=+/gm, '<h1>$1</h1>');
  md = md.replace(/^(.+)\n\-+/gm, '<h2>$1</h2>');
  
  //images
  md = md.replace(/\!\[([^\]]+)\]\(([^\)]+)\)/g, '<img src="$2" alt="$1" />');
  
  //links
  md = md.replace(/[\[]{1}([^\]]+)[\]]{1}[\(]{1}([^\)\"]+)(\"(.+)\")?[\)]{1}/g, '<a href="$2" title="$4">$1</a>');
  
  //font styles
  md = md.replace(/[\*\_]{2}([^\*\_]+)[\*\_]{2}/g, '<b>$1</b>');
  md = md.replace(/[\*\_]{1}([^\*\_]+)[\*\_]{1}/g, '<i>$1</i>');
  md = md.replace(/[\~]{2}([^\~]+)[\~]{2}/g, '<del>$1</del>');
  
  //pre
  md = md.replace(/^\s*\n\`\`\`(([^\s]+))?/gm, '<pre class="$2">');
  md = md.replace(/^\`\`\`\s*\n/gm, '</pre>\n\n');
  
  //code
  md = md.replace(/[\`]{1}([^\`]+)[\`]{1}/g, '<code>$1</code>');
  
  //p
  md = md.replace(/^\s*(\n)?(.+)/gm, function(m){
    return  /\<(\/)?(h\d|ul|ol|li|blockquote|pre|img)/.test(m) ? m : '<p>'+m+'</p>';
  });
  
  //strip p from pre
  md = md.replace(/(\<pre.+\>)\s*\n\<p\>(.+)\<\/p\>/gm, '$1$2');
  
  return md;
  
}

var rawMode = true;
    mdEl = document.getElementById('markdown'),
    outputEl = document.getElementById('output-html'),
    parse = function(){
      outputEl[rawMode ? "innerText" : "innerHTML"] = parseMd(mdEl.innerText);
    };

parse();
mdEl.addEventListener('keyup', parse, false);

//Raw mode trigger btn
(function(){

  var trigger = document.getElementById('raw-switch'),
      status = trigger.getElementsByTagName('span')[0],
      updateStatus = function(){
        status.innerText = rawMode ? 'On' : 'Off';
      };

  updateStatus();
  trigger.addEventListener('click', function(e){
    e.preventDefault();
    rawMode = rawMode ? false : true;
    updateStatus();
    parse();
  }, false);
  
}());
              
            
!
999px

Console