Pen Settings



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


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


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.


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.






                var term = $('body').terminal($.noop, {
    renderHandler: function(obj) {
        if (typeof obj !== 'string') {
        var promises = []; // each image is generated asynchronously
        // code based on examples from
        var ansiParser =  {
            backgroundColor: sixel.toRGBA8888(255, 0, 0, 255),
            inSixel: false,

            // inst_H: called whan a DCS sequence starts
            inst_H: function(collected, params, flag) {
                // q means incoming SIXEL image
                if (flag === 'q') {
                    image = new sixel.SixelDecoder(params[1] === 1 ? 0 : ansiParser.backgroundColor);
                    ansiParser.inSixel = true;

            // inst_P: called for SIXEL image chunks
            inst_P: function(chunk) {
                if (ansiParser.inSixel && image) {

            // inst_U: called when SIXEL image finishs
            inst_U: function() {
                if (ansiParser.inSixel) {
                    ansiParser.inSixel = false;
                    // render Sixel Image to canvas
                    var canvas = document.createElement('canvas');
                    var ctx = canvas.getContext("2d");
                    var imageData = ctx.createImageData(image.width, image.height);
                    image.toPixelData(, image.width, image.height);
                    ctx.putImageData(imageData, 0, 0);
                    if (this.result[this.cursor.y]) {
                    var y = this.cursor.y;
                    this.cursor.x = 0;
                    this.result[y] = '[[@;;]]';
                    var result = this.result;
                    promises.push(new Promise(function(resolve) {
                        canvas.toBlob(function(blob) {
                            var uri = URL.createObjectURL(blob);
                            result[y] = result[y].replace(/\[\[@;;\]\]/, '[[@;;;;' + uri + ']]');
            output: function() {
                var self = this;
                if (!promises.length) {
                    // there are no SIXEL images
                    return self.result.join('\n');
                return Promise.all(promises).then(function() {
                    return self.result.join('\n');
        // canvas to blob is async so we don't return the output
        // that will be missing the images
        $.terminal.from_ansi(obj, {ansiParser: ansiParser});
        const output = ansiParser.output();
        return output;

// markdown link
$.terminal.new_formatter([/\[([^]+)\]\((.*?)\)/g, function(_, label, url) {
    return `[[!;;;;${url}]${label}]`;

term.echo('Read more about [Sixel image format on Wikipedia](\n')

term.echo(fetch('').then(r => r.text()));