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

              
                <textarea id="incoming"></textarea>
<textarea id="outgoing"></textarea>
<br>
<button>Do it!</button>
              
            
!

CSS

              
                #incoming {
  width: 1000px;
  height: 50px;
}

#outgoing {
  width: 1000px;
  height: 300px;
}
              
            
!

JS

              
                $('button').on('click', function() {
  var text = $('#incoming').val();
  
  // to catch leaders/trailers
  text = '\n' + text + '\n';
  
  // line breaks
  text = text.replace(/([\r\n ]*<br \/>[\r\n ]*)+/g, '\n\n');
  
  // verbose centered images
  text = text.replace(/<div class="separator" style="clear: both; text-align: center;">/g, '<div style="text-align: center;">');
  
  // centered images
  text = text.replace(/<div style="text-align: center;">[\r\n ]*(.*?)[\r\n ]*<\/div>/g, '<div class="blog-image">$1</div>');
  
  // image border
  text = text.replace(/<img border="0"/g, '<img');
  
  // xhtml self-closing tags
  text = text.replace(/ \/>/g, '>');
  
  // before script
  text = text.replace(/[\r\n ]*<script/g, '\n\n<script');

  // after script
  text = text.replace(/<\/script>[\r\n ]*/g, '</scr' + 'ipt>\n\n');
  
  // rejoin codepen snippets
  text = text.replace(/<\/div>[\r\n ]*<script async="" src="\/\/codepen.io/g, '</div>\n<script async="" src="//codepen.io');
  
  // bold titles
  text = text.replace(/[\r\n ]+<b>(.*?)<\/b>[\r\n ]+/g, '\n\n<h3>$1</h3>\n\n');
  
  // italics
  text = text.replace(/<(\/?)i>/g, '<$1em>');

  // leftover bold
  text = text.replace(/<(\/?)b>/g, '<$1strong>');

  // trim
  text = text.trim();

  $('#outgoing').val(text);
});
              
            
!
999px

Console