Git Product home page Git Product logo

grav-prism-highlight's Introduction

Grav Prism Highlighter Plugin

Prism Highlighter is a Grav plugin that adds simple and powerful code highlighting functionality utilizing the Prism.js syntax highlighter.

Installation

At this time, this version of plugin is not avaiable via Grav Package Manager (GPM). To install you can clone the project. In the Grav root folder, execute:

cd /user/plugins/
git clone https://github.com/clemdesign/grav-prism-highlight.git grav-prism-highlight

Or download the latest release and unzip content in /user/plugins/prism-highlight

Languages included

Prism.js supports currently 122 languages, at the time of this edit.

Usage

In your markdown, you can create a block of code, and assign the language to it. You can choose between the list above. Example:

```java
  import java.util.HashSet;

  public class Program {
      public static void main(String[] args) {

    // Create HashSet.
    HashSet<String> hash = new HashSet<>();
    hash.add("castle");
    hash.add("bridge");
    hash.add("castle"); // Duplicate element.
    hash.add("moat");

    // Display size.
    System.out.println(hash.size());

    // See if these three elements exist.
    System.out.println(hash.contains("castle"));
    System.out.println(hash.contains("bridge"));
    System.out.println(hash.contains("moat"));
      }
  }```

Configuration

Configuration shall be set in config/plugins/prism-highlight.yaml.

Plugin shall be enabled through the option enabled.

You can also override the default theme for a page with the option theme.

You can choose between:

default
coy
dark
funky
okaidia
solarized-light
twilight

Check out a live test or a live demo. You can enbale the following plugins:

If you have the following error in console, disable the option "Javascript Minify" in Grav System Configuration.

Uncaught SyntaxError: Invalid regular expression: missing /

grav-prism-highlight's People

Contributors

alvr avatar clemdesign avatar flaviocopes avatar rhukster avatar ryanmpierson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.