Test Blogger Code Highlight with Highlight.js

Test Blogger Code Highlight with Highlight.js


highlight.js can be used in different ways such using CDNs, hosting the bundle yourself, as a Vue plug-in, as ES6 modules, with Node.js, and web workers.

Home :
https://highlightjs.org/

README on GitHub :
https://github.com/highlightjs/highlight.js

CDN :
https://cdnjs.com/libraries/highlight.js

NOTE ! Use HTML Escapetor for code with tags :
https://www.freeformatter.com/html-escape.html


<script 
 src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" 
 integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" 
 crossorigin="anonymous" 
 referrerpolicy="no-referrer">
</script>

<!-- Highlight.js Add For Clojure Language Support ↓ -->

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/clojure.min.js" integrity="sha512-KaEPWVghlkqO036k5Mrh5xEYznAGnzWWx7fpcWVGTsLlCtcovEXZy7wOkQQJk8JLRWR0pAOTI38os+rhQxflxg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<!-- Highlight.js Dark Style ↓ -->

<link 
 rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css" 
 integrity="sha512-Jk4AqjWsdSzSWCSuQTfYRIF84Rq/eV0G2+tu07byYwHcbTGfdmLrHjUSwvzp5HvbiqK4ibmNwdcG49Y5RGYPTg==" 
 crossorigin="anonymous" 
 referrerpolicy="no-referrer" 
/>

<script>hljs.highlightAll();</script>


import React from 'react';
import {Text, View} from 'react-native';

const HelloWorldApp = () => {
  return (
    <View
      style={{
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
      }}>
      <Text>Hello, world!</Text>
    </View>
  );
};
export default HelloWorldApp;


// This is Java

/**
 * @author John Smith <john.smith@example.com>
*/
package l2f.gameserver.model;

public abstract strictfp class L2Char extends L2Object {
  public static final Short ERROR = 0x0001;

  public void moveTo(int x, int y, int z) {
    _ai = null;
    log("Should not be called");
    if (1 > 5) { // wtf!?
      return;
    }
  }
}


;; This is Clojure 
(def ^:dynamic chunk-size 17)

(defn next-chunk [rdr]
  (let [buf (char-array chunk-size)
        s (.read rdr buf)]
  (when (pos? s)
    (java.nio.CharBuffer/wrap buf 0 s))))

(defn chunk-seq [rdr]
  (when-let [chunk (next-chunk rdr)]
    (cons chunk (lazy-seq (chunk-seq rdr)))))

/* This is CSS */
@font-face {
  font-family: CodingTrabla; src: url('CodingTrabla.otf');
}

body, .usertext {
  color: #F0F0F0; background: #600;
  font-family: Chunkfive, sans;
  --heading-1: 30px/32px Helvetica, sans-serif;
}

@import url(print.css);
@media print {
  a[href^=http]::after {
    content: attr(href)
  }
}

No comments:

Post a Comment