icon 42 Code Highlighter 2

Tags: Calc Draw Extensions Impress Writer

last edited: 2022-03-15

Rating:

Code snippet highlighter for LibreOffice.

code highlighter dialog v4

Description

Code Highlighter 2 allows syntax highlighting over 350 languages in LibreOffice.

Code Highlighter 2 is a fork of Code Highlighter, originally created by slgobinath but no more maintained.

Usage

  • Open a LibreOffice document.
  • Copy and paste the code snippet where you want it:
    • Writer: either in a text frame (preferred option), in a text box, in a table cell or as plain text;
    • Calc: either in a cell or in a text box;
    • Impress and Draw: in a text box.
  • Select the text or the object containing the code snippet.
  • Format -> Highlight Code:
    • in the dialog, select the language and style.
  • Alternatively Tools -> Highlight Code (previous settings):
    • does not open a dialog, but applies previous settings (persistent also between restarts of LO).

Tips

  • Multiselection is supported: you can select several code snippets at the same time, even from different languages (choose "automatic" in this last case).
  • Not all language aliases that are valide names for Code Highlighter 2 appear in the option dialog: if you don't find a language, try anyway to type its name in the combobox (try for example with "R" or with "Pascal").
  • Click the "More..." button to access line numbers options.
  • Uncheck line numbering option to remove unwanted line numbers, due for example to copy-pasted code.

General behaviour

  • Highlighting is applied to the selected object, that can be plain text, text frame, text shape, text table cell or calc cell.
  • When cursor is inside a text shape or a Calc cell, highlighting is applied to the whole shape or cell even if only a part of the text is selected.
  • When cursor is inside a text frame or a text table cell, highlighting is only applied to the selected text if any, otherwise to the whole frame or cell.
  • When highlighting applies to the selected text, it formats the entire paragraphs, even if selection starts after the paragraph start or ends before paragraph end.

Dependencies

Linux users may need to first install the LibreOffice script provider for python.

For Ubuntu and derivatives, close all the LibreOffice products and do

sudo apt-get install libreoffice-script-provider-python

Other Linux systems may not need this package. If you encounter any problems after installing the extension, please check whether you have any similar package.

Any problems?

If you find any bugs, please report them at GitHub Issues.

Screenshots

Dialog:

Result:

Homepage: https://github.com/jmzambon/libreoffice-code-highlighter

Repository: https://github.com/jmzambon/libreoffice-code-highlighter

Release List

  • Release Description Compatibility Operating Systems License Release notes  
  • v2.2.3 New features, bug fixes and code upgrade. 6.4 Linux, Windows, macOS GPL
    • Logging facilities.
    • Support for line numbering.
    • French localisation.
    • Upgrade Pygments to version 2.11.2.
    • Bug fixes.
    • Some code rewriting.
    Download
  • v2.0.1 Small fixes and upgrades 6.4 Linux, Windows, macOS GPL
    • Upgrade Pygments to version 2.11.1.
    • Fix error in getting lexer from some language aliases.
    • Fix error in undoing text box highlighting.
    Download
  • Code Highlighter 2 v2.0 - First release after forking Code Highlighter 6.4 Linux, Windows, macOS GPL
    • embed Pygments
    • support for text frame and table cell selection in Writer (frame selection is preferred)
    • support cell selection in Calc
    • show highlight operations in undo manager
    • add key shortcuts (Shift+Alt+X and Alt+X)
    • add Pygments icon and version in dialog box
    • add error messages for unsupported selection or no selection at all
    • add menu item icons
    • speed up dialog opening + sorted languages and styles
    • remove spelling language for highlighted code
    • various little enhancements and fixes
    • automatic updates
    Download

Other Extensions

APSO - Alternative Script Organizer for Python

Based on an original script from Hanya, APSO will install a macro organizer dedicated to python scripts.

06-2021

CountStyle

Two Calc functions for counting cells or cell content by cell style. Compatible with both Apache OpenOffice and LibreOffice.

05-2021

calCalc - Pop-up calendar for Calc

Simple, self-localized, gregorian type date picker for Calc

06-2021

Code Highlighter 2

Code snippet highlighter for LibreOffice.

03-2022

Feedback

Post your review

You cannot post reviews until you have logged in. Login Here.

Reviews

  • Carsten Timm Jun 1, 2022, 10:51 AM (30 days ago)

    Wahoo
    Danke dir
    Danke dir


    kannst du es auf java porten .-) für lern zwecke?
    der start zum plugin entwickeln mit Libreoffice Java war so lala.

  • Paul Fremdling Mar 24, 2022, 4:04 PM (3 months ago)

    Works excellent with LibreOffice 7.2

RSS feed for reviews on this page | RSS feed for all reviews