Sample dan CSS yang digunakan
CSS (Copy CSS ini ke Template)
.hljs{display:block;overflow-x:auto;padding:15px 0.5em 0.5em 30px;font-size:11px;line-height:16px}
pre{background:#f6f6ae url(https://cdn.jsdelivr.net/highlight.js/9.9.0/styles/school-book.png);border-top:solid 2px #d2e8b9;border-bottom:solid 1px #d2e8b9}
.hljs-keyword,.hljs-selector-tag,.hljs-literal{color:#005599;font-weight:bold}
.hljs,.hljs-subst{color:#3e5915}.hljs-string,.hljs-title,.hljs-section,.hljs-type,.hljs-symbol,.hljs-bullet,.hljs-attribute,.hljs-built_in,.hljs-builtin-name,.hljs-addition,.hljs-variable,.hljs-template-tag,.hljs-template-variable,.hljs-link{color:#2c009f}
.hljs-comment,.hljs-quote,.hljs-deletion,.hljs-meta{color:#e60415}
.hljs-keyword,.hljs-selector-tag,.hljs-literal,.hljs-doctag,.hljs-title,.hljs-section,.hljs-type,.hljs-name,.hljs-selector-id,.hljs-strong{font-weight:bold}
.hljs-emphasis{font-style:italic}
Contoh HTML, XML
<!DOCTYPE html>
<title>Title</title>
<style>body {width: 500px;}</style>
<script type="application/javascript">
function $init() {return true;}
</script>
<body>
<p checked class="title" id='title'>Title</p>
</body>
Contoh JavaScript
function $initHighlight(block, cls) {
try {
if (cls.search(/\bno\-highlight\b/) != -1)
return process(block, true, 0x0F) +
` class="${cls}"`;
} catch (e) {
}
for (var i = 0 / 2; i < classes.length; i++) {
if (checkCondition(classes[i]) === undefined)
console.log('undefined');
}
return (
<div>
<web-component>{block}</web-component>
</div>
)
}
export $initHighlight;