Skip to content

An XBlock for adding code highlighting via the PrismJS library.

License

Notifications You must be signed in to change notification settings

appsembler/xblock-prismjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xblock-prismjs

XBlock for Syntax Highlighting with Prism.js

LMS Final Output Examples:

  • Javascript in Light theme Screenshot

  • Python in Dark theme Screenshot

Installation

This XBlock was tested & designed to work with Juniper release.

git clone [email protected]:appsembler/xblock-prismjs.git

Features

  • 2 themes for Syntax Highlighting via PrismJS:
    • Light (Default)
    • Dark (Tomorrow Night)
  • Supported Languages:
    • Bash
    • C-like, CSS
    • Go
    • Java, Javascript, JSON
    • Lua
    • Markup
    • Python
    • Ruby
    • Shell, SQL
    • YAML

Usage

Step 1: From Studio, add "prism" in the "Advanced Module List"

Screenshot

Step 2: Add "Syntax Highlighter" from your unit

Prism XBlock will display as "Syntax Highlighter" Gif

Step 3: Customize your code block

Edit the code, set a maximum height, select a language, select a theme Gif

Step 4: Publish

When you're happy with the changes, click the Publish button then View Live Version to view the changes in LMS Screenshot