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

              
                <h1>Emojis API Demo</h1>

<p class="info">An example of using the <a href="https://buildkite.com/docs/api/emojis">Buildkite Emojis API</a> to fetch an account’s list of emojis and then emojify a paragraph of text.</p>

<div class="demo">
  <p class="source">Let’s :rocket: all the :ruby: :package: after :bundler: and :postgres: finish building!</p>
  <p class="result loading">Loading emojis...</p>
</div>
              
            
!

CSS

              
                body { padding: 1rem 0; max-width: 22em; margin: 0 auto; font: 24px/1.2 Avenir, Helvetica, sans-serif; }
h1, p { margin: 1.5rem 0; }
a { color: #317ef2; }
.demo { font-size: 21px; }
.info, .loading { color: #999; }
img.emoji { max-height: 21px; max-width: 21px; vertical-align: bottom; }
              
            
!

JS

              
                fetchEmojis().then(function(emojis) {
  var source = document.querySelector('.source');
  var result = document.querySelector('.result');

  result.classList.remove('loading');
  result.innerHTML = emojify(source.innerText, emojis);
})

function fetchEmojis() {
  var url = "https://api.buildkite.com/v1/accounts/tim-test-account/emojis?access_token=5a866ae0dfd3b62daac8fdf3f092d5edbe3ee906";
  return window.fetch(url).
    then(function(response) { return response.json() }).
    then(buildEmojiLookupTable);
}

// Replaces all :emoji: in the given text with matching emoji images
function emojify(text, emojis) {
  return text.replace(/:([\w+-]+):/gm, function(original, name) {
    if (emojis[name]) {
      return '<img class="emoji" src="' + emojis[name] + '" alt="' + name + '">';
    } else {
      return original;
    }
  });
}

// Build the emoji data lookup table with alias support
// 'panda_face' => 'https://..'
function buildEmojiLookupTable(json) {
  var emojis = {};
  
  json.forEach(function(emoji) {
    emojis[emoji.name] = emoji.url;

    if (emoji.aliases) {
      emoji.aliases.forEach(function(alias) {
        emojis[alias] = emoji.url;
      });
    }
  });

  return emojis;
}

              
            
!
999px

Console