cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv
Planned migrations in progress! PRO features temporarily disabled.

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <h2>Original</h2>
<pre id="original"></pre>
<h2>Stripped</h2>
<pre id="stripped"></pre>
            
          
!
            
              /**
 * Allows Scala-like stripMargin
 *
 * Parameters are applied implicitly via ES2015.
 *
 * @example
 * // returns "The Number is:\n    100\nThanks for playing!"
 * let num = 100
 * let result = stripMargin`The Number is:
 *         |    ${num}
 *         |Thanks for playing!`
 * get the gist: https://gist.github.com/jimschubert/06fea56a6d2a1e7fdbc2
 */
function stripMargin(template, ...expressions) {
  let result = template.reduce((accumulator, part, i) => {
    return accumulator + expressions[i - 1] + part
  })

  return result.replace(/\r?(\n)\s*\|/g, '$1');
}

class App {
    constructor(){
      this.text =`
         This is an example of what could be considered a 
         "problem" with ES6 multiline strings.

         Each of these lines will have 7 characters of whitespace
         at the beginning of the line.`;
    }
}

class AppStripped {
    constructor(){
      this.text = stripMargin`
         |This is an example of using the stripMargin 
         |tag template helper.
         |
         |Each of these lines is prefixed with a | character
         |which indicates the start of the line in the 
         |templated string.`;
    }
}

document.getElementById('original').innerText = new App().text;

document.getElementById('stripped').innerText = new AppStripped().text;
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console