Skip to content

An extension for oobabooga's text-generation-webui that adds syntax highlighting to code snippets

Notifications You must be signed in to change notification settings

DavG25/text-generation-webui-code_syntax_highlight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code Syntax Highlight

An extension for oobabooga's text-generation-webui to highlight code snippets

Note

Versions of text-generation-webui released after the 26th of April 2024 support syntax highlighting of code snippets by default without needing this extension

code_syntax_highlight_extension-oobabooga-text-generation-webui

Features

  • Uses highlight.js with the GitHub theme
  • Supports common programming languages
  • Can also highlight inline code snippets
  • Provides an optional button in each code snippet to copy the code to the clipboard
  • Works in all interface modes: default, notebook, and chat
  • Automatically switches between light and dark themes to match the web UI theme
  • Has a performance mode for minimal CPU usage

Installation

The extension can be installed by cloning this repository inside the ../text-generation-webui/extensions folder:

cd text-generation-webui/extensions
git clone https://github.com/DavG25/text-generation-webui-code_syntax_highlight code_syntax_highlight

It's also possible to install the extension by directly downloading the latest version from the releases page and extracting the ZIP archive inside the ../text-generation-webui/extensions folder


Updates

To check for updates, simply compare the currently installed extension version in the web UI with the latest available version in the releases page

If the available version is higher than the installed one, run the following command:

cd text-generation-webui/extensions
git pull

If the extension was installed by downloading the ZIP archive, delete the currently installed version in the ../text-generation-webui/extensions folder and extract the new version ZIP archive in the same location


Configuration and persistent settings

The extension can be enabled directly in the Interface mode tab inside the web UI once installed

To automatically load the extension when starting the web UI, either specify it in the --extensions command-line flag or add it in the settings.yaml file in the ../text-generation-webui folder:

default_extensions: 
- code_syntax_highlight

For settings to persist over web UI restarts and reloads, add the following lines to the settings.yaml file:

code_syntax_highlight-activate: true
code_syntax_highlight-inline_highlight: false
code_syntax_highlight-copy_button: false
code_syntax_highlight-performance_mode: true

Change the values (true / false) according to the preferred settings

About

An extension for oobabooga's text-generation-webui that adds syntax highlighting to code snippets

Resources

Stars

Watchers

Forks

Packages

No packages published