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

              
                <!--
 you can try to combine it with:
 https://github.com/nolanlawson/emoji-picker-element
-->
              
            
!

CSS

              
                body {
    margin: 0;
    height: 100vh;
    --size: 1.5;
}
/* hack for version 2.29.1 */
.terminal {
    --glow: x;
}
/*
use css below if you use

--animation: terminal-underline

span:not(.cursor) > .emoji {
    top: 1px;
}
.cursor .emoji {
    top: -1px;
}
*/

.cmd .emoji, .terminal-output>:not(.raw) .emoji {
    background-size: contain;
    background-repeat: no-repeat;
}
              
            
!

JS

              
                var term = $('body').terminal(function(command) {
    const cmd = $.terminal.parse_command(command);
    if (cmd.name == 'apropos') {
        names.filter(name => name.match(cmd.args[0])).forEach(name => {
            term.echo(`${name}: :${name}:`);
        });
    } else {
        this.echo('you typed [[bi;#fff;]' + JSON.stringify(command) + ']', {
            formatters: false
        });
    }
}, {
    name: 'emoji',
    // detect iframe codepen preview
    enabled: $('body').attr('onload') === undefined,
    onInit: function() {
        // in Window 10 it will render 8️⃣ as icon
        // in other browsers you may render it as
        // text
        this.echo('type &#58;smiley&#58; or &#58;&#41; to render emoji :smiley:')
            .echo('<span><div data-text>You can also paste Unicode codepoints that create emoji ' +
                  'like 8️⃣ to render </span><span style="width: 2ch" class="emoji eight" '+
                  'data-text="8️⃣">8️⃣</span></span>', {raw: true})
            .echo('you need to wait a moment while we fetch emoji data')
            .echo('to see available emoji use apropos command (e.g. apropos /smil/)');
    },
    completion: function(string, callback) {
        if (string.match(/^:/)) {
            return names.map(function(name) {
                return ':' + name + ':';
            });
        } else {
            return commands;
        }
    }
});
// for codepen preview
if (!term.enabled()) {
    term.find('.cursor').addClass('blink');
}
var commands = ['apropos'];
var names = [];
var list;
$.get('https://cdn.jsdelivr.net/npm/emoji-datasource').then(function(list) {
    $.terminal.emoji(list);
    names = list.map(function(emoji) { return emoji.short_name; });
    term.clear_cache().refresh();
    if (term.get_command()) {
        term.cmd().resize();
    }
});

// regexes copy from jQuery Terminal source code
var re_re = /(\/((?:\\\/|[^/]|\[[^\]]*\/[^\]]*\])+)\/([gimsuy]*))/g;
var string_re = /("(?:[^"\\]|\\(?:\\\\)*"|\\\\)*"|'(?:[^'\\]|\\(?:\\\\)*'|\\\\)*'|`(?:[^`\\]|\\(?:\\\\)*`|\\\\)*`)/g;

$.terminal.new_formatter([new RegExp(commands.join('|'), 'g'), '[[;white;]apropos]']);
$.terminal.new_formatter(function(input) {
    return input
        .replace(re_re, '[[;rebeccapurple;]$1]')
        .replace(string_re, '[[;green;]$1]');
});

github('jcubic/jquery.terminal');
/*
$.terminal.defaults.allowedAttributes.push('style');
term.echo('[[;;;emoji smiley;;{"style": "width:2ch;display:inline-block;"}]☺️]y')
term.echo('😂')
*/

              
            
!
999px

Console