Cara Memasang Syntax Highlighter Di Blogger

Cara Memasang Prism Syntax Highlighter Di Blogger - Hello Kali Ini Saya Hekthatman Akan Mmberikan Tutorial Untuk Anda , Cara Membuat/Memasang Prism Syntax Highlighter Di Blogger Untuk Anda , Bagi Yang Belum Tahu Apa Itu Syntax Highlighter Saya Akan Memberikan Infonya Untuk Anda.

Apa Itu Syntax Highlighter ?

Syntax Highlighter Adalah Sebuah Code | HTML , CSS , JAVASCRIPT JQUARY | Yang Buat Lebih Cantik Atau Bagus Lebih Berwarna Dan Pastinya Keren Untuk Anda.

Cara Memasang Prism Syntax Highlighter Di Blogger


Pertama Anda Ke Blogger Kamu Dulu
Template === > Edit Template
Kamu Cari Kode Cssnya Dulu Yaitu : </style> Atau Juga Bisa ]]></b:skin>
Kamu Copy Kode Yang Di Bawah Ini Dan Pastekan 
Tepat Di Atas </style> Atau Juga Bisa ]]></b:skin>

CSS

pre {
    padding: 50px 10px 10px 10px;
    margin: .5em 0;
    white-space: pre;
    word-wrap: break-word;
    overflow: auto;
    background-color: #2c323c;
    position: relative;
    border-radius: 4px;
    max-height: 500px;
}

pre::before {
    font-size: 16px;
    content: attr(title);
    position: absolute;
    top: 0;
    background-color: #eee;
    padding: 10px;
    left: 0;
    right: 0;
    color: #fff;
    text-transform: uppercase;
    display: block;
    margin: 0 0 15px 0;
    font-weight: bold;
}

pre::after {
    content: 'Double click to selection';
    padding: 2px 10px;
    width: auto;
    height: auto;
    position: absolute;
    right: 8px;
    top: 8px;
    color: #fff;
    line-height: 20px;
    transition: all 0.3s ease-in-out;
}

pre:hover::after {
    opacity: 0;
    top: -8px;
    visibility: visible;
}

code {
    font-family: Consolas,Monaco,'
    Andale Mono','Courier New',Courier,Monospace;
    line-height: 16px;
    color: #87A4A8;
    background-color: transparent;
    padding: 1px 2px;
    font-size: 12px;
}

pre code {
    display: block;
    background: none;
    border: none;
    color: #EAE5E5;
    direction: ltr;
    text-align: left;
    word-spacing: normal;
    padding: 0 0;
    font-weight: bold;
}

code .token.punctuation {
    color: #ccc;
}

pre code .token.punctuation {
    color: #FBF7F7;
}

code .token.comment,code .token.prolog,code .token.doctype,code .token.cdata {
    color: #777;
}

code .namespace {
    opacity: .8;
}

code .token.property,code .token.tag,code .token.boolean,code .token.number {
    color: #E9DF50;
}

code .token.selector,code .token.attr-name,code .token.string {
    color: #82A5A9;
}

pre code .token.selector,pre code .token.attr-name {
    color: #FBF7F7;
}

pre code .token.string {
    color: #35E93B;
}

code .token.entity,code .token.url,pre .language-css .token.string,pre .style .token.string {
    color: #ccc;
}

code .token.operator {
    color: #1489E3;
}

code .token.atrule,code .token.attr-value {
    color: #019595;
}

pre code .token.atrule,pre code .token.attr-value {
    color: #1AB5B7;
}

code .token.keyword {
    color: #EB400F;
    font-style: italic;
}

code .token.comment {
    font-style: italic;
}

code .token.regex {
    color: #ccc;
}

code .token.important {
    font-weight: bold;
}

code .token.entity {
    cursor: help;
}

pre mark {
    background-color: #F15150!important;
    color: #fff!important;
    padding: 2px;
    border-radius: 2px;
}

code mark {
    background-color: #F15150!important;
    color: #fff!important;
    padding: 2px;
    border-radius: 2px;
}

pre code mark {
    background-color: #F15150!important;
    color: #fff!important;
    padding: 2px;
    border-radius: 2px;
}

.comments pre {
    padding: 10px 10px 15px 10px;
    background: #2A2E36;
}

.comments pre::before {
    content: 'Code';
    font-size: 13px;
    position: relative;
    top: 0;
    background-color: #F96751;
    padding: 3px 10px;
    left: 0;
    right: 0;
    color: #fff;
    text-transform: uppercase;
    display: inline-block;
    margin: 0 0 10px 0;
    font-weight: bold;
    border-radius: 4px;
    border: none;
}

.comments pre::after {
    font-size: 11px;
}

.comments pre code {
    color: #eee;
}

.comments pre.line-numbers {
    padding-left: 10px;
}

pre.line-numbers {
    position: relative;
    padding-left: 3.0em;
    counter-reset: linenumber;
}

pre.line-numbers > code {
    position: relative;
}

.line-numbers .line-numbers-rows {
    height: 100%;
    position: absolute;
    pointer-events: none;
    top: 0;
    font-size: 100%;
    left: -3.5em;
    width: 3em;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    padding: 0;
}

.line-numbers-rows > span {
    pointer-events: none;
    display: block;
    counter-increment: linenumber;
}

.line-numbers-rows > span:before {
    content: counter(linenumber);
    color: #999;
    display: block;
    padding-right: 0.8em;
    text-align: right;
    transition: 350ms;
}

pre[data-codetype='CSSku']:before {
    background-color: #07B3EC;
}

pre[data-codetype='HTMLku']:before {
    background-color: #3EDF96;
}

pre[data-codetype='JavaScriptku']:before {
    background-color: #5AE9E0;
}

pre[data-codetype='JQueryku']:before {
    background-color: #FABC51;
}

Kemudian Kita Pasang Kode Jquery Dulu ,  Codenya Ada Dua , Kamu Pasang Tepat Di Atas </body>

JQuery | Pertama

<script type='text/javascript'>
var pres = document.getElementsByTagName(&quot;pre&quot;);
for (var i = 0; i &lt; pres.length; i++) {
  pres[i].addEventListener(&quot;dblclick&quot;, function () {
    var selection = getSelection();
    var range = document.createRange();
    range.selectNodeContents(this);
    selection.removeAllRanges();
    selection.addRange(range);
  }, false);
}
</script>

JQuery | Kedua

<script>
$('pre').attr('class', 'line-numbers');
Prism.hooks.add("after-highlight",function(e){var t=e.element.parentNode;if(!t||!/pre/i.test(t.nodeName)||t.className.indexOf("line-numbers")===-1){return}var n=1+e.code.split("\n").length;var r;lines=new Array(n);lines=lines.join("<span></span>");r=document.createElement("span");r.className="line-numbers-rows";r.innerHTML=lines;if(t.hasAttribute("data-start")){t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)}e.element.appendChild(r)})
</script>

Kamu Pasang Kedua Kode JQuery Nya Tepat Di Atas </body>

Kemudian Kita Pasang Kode Javascriptnya , Kamu Pasang Juga Tepat Di Atas </body> Juga

Javascript

<script src='https://arlina-design.googlecode.com/svn/prism.js' type='text/javascript'/>

Kemudian Kamu Simpan Template Kamu.

Untuk Membuat Biar Tampil Di Postingan Kamu Pakai Kode Yang Di Bawah Ini Saat Anda Memasang  | HTML , CSS , JAVASCRIPT JQUARY | Di Postingan Blog Anda.

HTML

<pre title="HTML" data-codetype ="HTML"><code class="language-marp"> ... pasang HTML di sini ... </code></pre>

CSS

<pre title="CSS" data-codetype ="CSS"><code class="language-css"> ... pasang CSS di sini ... </code></pre>

JAVASCRIPT

<pre title="Javascript" data-codetype ="JavaScript"><code class="language-javascript"> ... pasang JavaScript di sini ... </code></pre>

JQUERY

<pre title="jQuery" data-codetype ="JQuery"><code class="language-javascript"> ... pasang jQuery di sini ... </code></pre>

Masukan Kodenya Sesuai Kategorinya Oke Di Postingan Anda.

Sekian Dan Terima Kasih.

sumber kode script : arlina design | tapi udah saya udah dikit warnanya biar keren


EmoticonEmoticon