cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

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.

            
              body {
    margin: 0;
    height: 100vh;
    --size: 1.5;
}
.emoji {
    width: calc(var(--size, 1) * 14px);
    height: calc(var(--size, 1) * 14px);
    background-size: cover;
    display: inline-block;
    color: transparent;
    position: relative;
}
/*
use css below if you use

--animation: terminal-underline

span:not(.cursor) > .emoji {
    top: 1px;
}
.cursor .emoji {
    top: -1px;
}
*/
            
          
!
            
              function escape_formatters(string) {
    return string.replace(/:/g, '&#58;').replace(/\)/g, '&#41;')
        .replace(/(foo|bar|baz)/g, function(word) {
            return word.replace(/./g, function(chr) {
                return '&#' + chr.charCodeAt(0) + ';';
            });
        });
}

var term = $('body').terminal(function(command) {
    this.echo('you typed ' + JSON.stringify(escape_formatters(command)));
}, {
    name: 'emoji',
    onInit: function() {
        this.echo('type &#58;smiley&#58; or &#58;&#41; to render emoji :smiley:')
            .echo('you need to wait a moment while we fetch emoji data')
            .echo('to see available emoji type &#58;&lt;CHAR(S)&gt; and press tab twice')
    },
    completion: function(string, callback) {
        if (string.match(/^:/)) {
            callback(names.map(function(name) {
                return ':' + name + ':';
            }));
        }
    }
});
var base = 'https://rawgit.com/iamcal/emoji-data/master/img-emojione-64/';
var names = [];
$.get('https://rawgit.com/iamcal/emoji-data/master/emoji.json').then(function(list) {
    var text = {};
    list.forEach(function(emoji) {
        if (emoji.text && !text[emoji.text]) {
            text[emoji.text] = emoji.short_name;
        }
        names.push(emoji.short_name);
    });
    
    // new API from version 1.10.0, old one with function will still work but
    // if you need to use replacement that change length of the output text
    // you need to use [regex, str]
    $.terminal.defaults.formatters.push([
        new RegExp(':(' + names.map((name) => $.terminal.escape_regex(name)).join('|') + '):', 'g'),
        '[[;;;emoji $1]⻇]'
    ]);
    Object.keys(text).forEach(function(name) {
        $.terminal.defaults.formatters.push([
            new RegExp($.terminal.escape_regex(name), 'g'),
            '[[;;;emoji ' + text[name] + ']⻇]'
        ]);
    });
    $.terminal.defaults.formatters.push([/(foo|bar|baz)/g, 'text_$1']);
    term.refresh();
});

github('jcubic/jquery.terminal');
            
          
!
999px
Loading ..................

Console