Code Highlight

This module adds highlight, line number, copy button and language display to the core/code block.

If you have never worked with core/code block, then I suggest you read here first.

You can enable this module via “WordPress Dashboard -> Plover Kit -> Modules -> Code Highlight

Preview

Here’s an example of code in Go using Github Copilot theme.

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Code Block Options

Style

This option is a toggle that allows you to enable or disable highlighting for an individual code block.

Theme

We provide 10 free themes for you to choose from, you can continue reading to see a preview of each theme.

Language

We support 18 popular programming languages, a full list of which you can view below.

Show line numbers

This is a premium feature, Upgrade ↗.

Displays the line number at the beginning of each line.

Show language

This is a premium feature, Upgrade ↗.

Displays the current programming language when the mouse is over the code block.

Show copy button

This is a premium feature, Upgrade ↗.

Displays a copy button when the mouse is over the code block. Users can quickly copy the code by clicking this button.

Module Options

You can visit the module settings via “WordPress Dashboard -> Plover Kit -> Modules -> Code Highlight -> Settings

Unlike the code block options, the options here will be the default value for each code block option. You can make global changes to all code blocks that use the default settings here.

Supported Language

Here is a complete list of currently supported programming languages.

  • C-Like
  • Markup
  • HTML
  • XML
  • SVG
  • CSS
  • JavaScript
  • TypeScript
  • React JSX
  • React TSX
  • Go
  • C
  • C#
  • C++
  • PHP
  • JSON
  • Python
  • Rust

Themes Preview

GitHub Dark

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

GitHub Light

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

All themes below are premium themes, please upgrade ↗.

GitHub Copilot

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Twilight

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Monokai

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Solarized Light

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Solarized Dark

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Tomorrow Night

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

One Light

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

VSC Dark

package main

import "fmt"

func main() {
    ch := make(chan float64)
    ch <- 1.0e10    // magic number
    x, ok := <- ch
    defer fmt.Println(`exitting now\`)
    go println(len("hello world!"))
    return
}

Leave a Reply

Your email address will not be published. Required fields are marked *