Easy Syntax Highlighting Library – CSPSH.js

Category: Javascript | March 28, 2022
Author:Chandra-sekhar-pilla
Views Total:55 views
Official Page:Go to website
Last Update:March 28, 2022
License:MIT

Preview:

Easy Syntax Highlighting Library – CSPSH.js

Description:

CSPSH is a tiny and easy-to-implement syntax highlighting library that helps developers showcase their code snippets in a nice way.

Features:

  • Light and Dark modes.
  • Copy code snippets with a single click.
  • Supports JavaScript, Java, C, C++, and StoryScript.
  • 3 built-in themes.

How to use it:

1. Import the CSPSH.

<script src="/path/to/CSPSH.js" type="module"></script>

2. Add your code snippets into a DIV container with the CSS class of CSPSH, specify the language in the lang attribute and select a theme as follows:

<div class="CSPSH" lang="java" name="example" theme="cspsh">       
  public class SumOfNumbers1
  {
  public static void main(String args[])
  {
  int n1 = 225, n2 = 115, sum;
  sum = n1 + n2;
  System.out.println("The sum of numbers is: "+sum);
  }
  }
</div>

3. Programming languages supported:

<div class="CSPSH" lang="java" name="example">       
  Java
</div>
<div class="CSPSH" lang="js" name="example">       
  JavaScript
</div>
<div class="CSPSH" lang="c" name="example">       
  C
</div>
<div class="CSPSH" lang="cpp" name="example">       
  C++
</div>
<div class="CSPSH" lang="sts" name="example">       
  storyscript
</div>

4. Available themes.

<div class="CSPSH" lang="java" name="example" theme="cspsh">       
  Java
</div>
<div class="CSPSH" lang="js" name="example" theme="monokai">       
  JavaScript
</div>
<div class="CSPSH" lang="c" name="example" theme="drakula">       
  C
</div>

5. To enable dark mode, just add the dark Class to the DIV container.

<div class="CSPSH dark" lang="java" name="example" theme="cspsh">
  Java
</div>

Changelog:

03/28/2022

  • Hotfix

You Might Be Interested In:


Leave a Reply