PRISM.js Demo

var cursor = null;
if (items && items.length > 0) {
    cursor = parseInt(items[items.length - 1].timestamp) + 1;
}
var bodyFromEntry = function (entry) {
        if (entry.gd$extendedProperty) {
            for (var k in entry.gd$extendedProperty) {
                if (entry.gd$extendedProperty[k].name == 'blogger.contentRemoved') {
                    return '<span class="deleted-comment">' + entry.content.$t + '</span>';
                }
            }
        }
        return entry.content.$t;
    }
var parse = function (data) {
        cursor = null;
        var comments = [];
        if (data && data.feed && data.feed.entry) {
            for (var i = 0, entry; entry = data.feed.entry[i]; i++) {
                var comment = {};
                // comment ID, parsed out of the original id format
                var id = /blog-(\d+).post-(\d+)/.exec(entry.id.$t);
                comment.id = id ? id[2] : null;
                comment.body = bodyFromEntry(entry);
                comment.timestamp = Date.parse(entry.published.$t) + '';
                if (entry.author && entry.author.constructor === Array) {
                    var auth = entry.author[0];
                    if (auth) {
                        comment.author = {
                            name: (auth.name ? auth.name.$t : undefined),
                            profileUrl: (auth.uri ? auth.uri.$t : undefined),
                            avatarUrl: (auth.gd$image ? auth.gd$image.src : undefined)
                        };
                    }
                }
                if (entry.link) {
                    if (entry.link[2]) {
                        comment.link = comment.permalink = entry.link[2].href;
                    }
                    if (entry.link[3]) {
                        var pid = /.*comments\/default\/(\d+)\?.*/.exec(entry.link[3].href);
                        if (pid && pid[1]) {
                            comment.parentId = pid[1];
                        }
                    }
                }
                comment.deleteclass = 'item-control blog-admin';
                if (entry.gd$extendedProperty) {
                    for (var k in entry.gd$extendedProperty) {
                        if (entry.gd$extendedProperty[k].name == 'blogger.itemClass') {
                            comment.deleteclass += ' ' + entry.gd$extendedProperty[k].value;
                        }
                    }
                }
                comments.push(comment);
            }
        }
        return comments;
    };
var paginator = function (callback) {
        if (hasMore()) {
            var url = config.feed + '?alt=json&v=2&orderby=published&reverse=false&max-results=50';
            if (cursor) {
                url += '&published-min=' + new Date(cursor).toISOString();
            }
            window.bloggercomments = function (data) {
                var parsed = parse(data);
                cursor = parsed.length < 50 ? null : parseInt(parsed[parsed.length - 1].timestamp) + 1
                callback(parsed);
                window.bloggercomments = null;
            }
            url += '&callback=bloggercomments';
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = url;
            document.getElementsByTagName('head')[0].appendChild(script);
        }
    };
var hasMore = function () {
        return !!cursor;
    };
var getMeta = function (key, comment) {
        if ('iswriter' == key) {
            var matches = !! comment.author && comment.author.name == config.authorName && comment.author.profileUrl == config.authorUrl;
            return matches ? 'true' : '';
        } else if ('deletelink' == key) {
            return config.baseUri + '/delete-comment.g?blogID=' + config.blogId + '&postID=' + comment.id;
        } else if ('deleteclass' == key) {
            return comment.deleteclass;
        }
        return '';
    };
var replybox = null;
var replyUrlParts = null;
var replyParent = undefined;
var onReply = function (commentId, domId) {
        if (replybox == null) {
            // lazily cache replybox, and adjust to suit this style:
            replybox = document.getElementById('comment-editor');
            if (replybox != null) {
                replybox.height = '250px';
                replybox.style.display = 'block';
                replyUrlParts = replybox.src.split('#');
            }
        }
        if (replybox && (commentId !== replyParent)) {
            document.getElementById(domId).insertBefore(document.getElementById('threaded-comment-form'), null);
            replybox.src = replyUrlParts[0] + (commentId ? '&parentID=' + commentId : '') + '#' + replyUrlParts[1];
            replyParent = commentId;
        }
    };
var hash = (window.location.hash || '#').substring(1);
var startThread, targetComment;
if (/^comment-form_/.test(hash)) {
    startThread = hash.substring('comment-form_'.length);
} else if (/^c[0-9]+$/.test(hash)) {
    targetComment = hash.substring(1);
}
// Configure commenting API:
var configJso = {
    'maxDepth': config.maxThreadDepth
};
var provider = {
    'id': config.postId,
    'data': items,
    'loadNext': paginator,
    'hasMore': hasMore,
    'getMeta': getMeta,
    'onReply': onReply,
    'rendered': true,
    'initComment': targetComment,
    'initReplyThread': startThread,
    'config': configJso,
    'messages': msgs
};
var render = function () {
        if (window.goog && window.goog.comments) {
            var holder = document.getElementById('comment-holder');
            window.goog.comments.render(holder, provider);
        }
    };
// render now, or queue to render when library loads:
if (window.goog && window.goog.comments) {
    render();
} else {
    window.goog = window.goog || {};
    window.goog.comments = window.goog.comments || {};
    window.goog.comments.loadQueue = window.goog.comments.loadQueue || [];
    window.goog.comments.loadQueue.push(render);
}
})();
/* Primary Content ------------------ */

@import url(http://fonts.googleapis.com/css?family=Questrial);
@import url(http://fonts.googleapis.com/css?family=Arvo);

#main-wrapper {
  width:100%;
  text-align:left;
  clear:both;
}

#main {
  padding:0 5px;
}

.main .widget {
  margin:0 0 0 0;
}

.main .Blog {
  border-bottom-width:0 !important;
}

.post-labels,
.posting-dates,
.post-comment-link,
.post-author-vcard {
  margin-right:10px;
}

.post-header-line-1 {
  margin:5px 0 15px;
  font-size:11px;
  padding-bottom:5px;
  font:Helvetica,Arial,Sans-serif;
  display:none;
}

.post {
  float:left;
  margin:5px;
  padding:5px;
  width:72px;
  height:72px;
  overflow:hidden;
  border:1px solid #e4e3d5;
  background:#e4e3d5;
  opacity:0.8;
}

.post:hover {
  opacity:1;
}

.post h3 {
  margin:0 0 20px 0;
  display:none;
  overflow:hidden;
}

.post h3 a,
.post h3 a:visited,
.post h3 strong {
  font-family:Georgia,"Times New Roman",Serif;
  text-decoration:none;
  font-size:30px;
  color:#4b4b4b;
  display:none;
  border-bottom:3px solid #ddd;
}

.post h3 strong,
.post h3 a:hover {
  color:#222;
}

.post-body {
  margin:0;
  padding:0;
  width:72px;
  height:75px;
  overflow:hidden;
}

.post-body blockquote {
  line-height:1.3em;
  padding:10px;
  font-size:18px;
  font-family:Georgia,Serif;
  font-style:italic;
  color:$textcolor;
  border-top:1px solid $bordercolor;
  border-bottom:1px solid $bordercolor;
}

.post blockquote {
  margin:1em 20px;
}

.post blockquote p {
  margin:0;
  padding:0;
}

.post-footer {
  background:#f5f5f5;
  margin:20px 0 15px;
  font-size:10px;
  text-transform:uppercase;
  font-family:"Trebuchet MS",Hervetica,Arial,Sans-serif;
  padding:7px 10px 5px 10px;
  display:none;
}

.post-footer-line-2 {
  margin-top:5px;
}

.comment-link {
  margin-left:.6em;
}

.post img,
table.tr-caption-container {
  max-width:790px;
  height:auto;
  margin:0;
  overflow:hidden;
}

.tr-caption-container img {
  border:none;
  padding:0;
}

.thumb img {
  float:left;
}

.jump-link {
  margin-top:10px;
}
<!DOCTYPE html>
<html class="no-js">
    <head>
        <meta charset="utf-8">
        <title>Sample Page</title>
        <style type="text/css">
        * {margin:0;padding:0}
        div {background-color:red}
        mark {
          display:inline;
          background-color:yellow;
          color:black;
        }
        </style>
    </head>
    <body>
        <script>console.log('Prikitiw!');</script>
        <script type="text/javascript">
        //<![CDATA[
        console.log('Prikitiw!');
        //]]>
        </script>
        <div id="page-wrap">
            <a href="http://latitudu.blogspot.com" target="_blank">Lorem Ipsum</a>
            Lorem ipsum dolor sit amet...
        </div>
    </body>
</html>
<b:if cond='data:blog.metaDescription'>
    <meta expr:content='data:blog.metaDescription' name='description'/>
</b:if>
<?php get_header(); ?>
<div class="box">
    <img src="<?=_p()?>/images/empty.gif" class="green-leaves" alt="" />
    <div class="box-t">&nbsp;</div>
    <div class="box-c">
        <div class="box-cnt two-columns">
            <div class="cl">&nbsp;</div>
            <div class="side-left">
                <div class="posts">
                    <h2 class="center">Error 404 - Not Found</h2>
                </div>
            </div>
            <div class="side-right">
                <?php get_sidebar(); ?>
            </div>
            <div class="cl">&nbsp;</div>
        </div>
    </div>
    <div class="box-b">&nbsp;</div>
</div>
<?php get_footer(); ?>
package com.prismjs;

import java.io.*;

@SuppressWarnings("unchecked")
public class PrismJS {

    public static Integer test = 0;

    /**
     * Javadoc style comment
     * 
     * @param args
     */
    public static void main(String[] args) {
        // Let's create some variables
        int numArgs = args.length;
        Integer a = 0x1;
        String test = "" + "Hello" + " \"World\"!";
        double dvalue = 1.23;
        int optest = 0;
        optest += 321 - 45 * 1247 / 425 % 123;
        
        /*
         * Multiline comment
         */
        for (int i = 0; i < numArgs; i++) {
            // Simple line comment
            System.out.println("Arg value= " + args[i]);
        }

        do {
            System.out.println("Do while ok!");
        } while (false);
    }
}
×