Tags: Calc Extensions Impress Writer
Rating: ★ ☆ ☆ ☆ ☆
This extension highlights the code snippets over 350 languages in LibreOffice.
To highlight a code snippet, follow these steps:
- Insert a new Text Box (Insert -> Text Box)
- Copy and paste/write your code snippet into the text box (You can choose any fonts based on your preference)
- Select the text box
- Go to Tools -> Highlight Code -> <Language of the code>
That's it. Your code should be colored based on the syntax.
I have tested only a few languages. If you find any bugs, please report them at GiHub Issues.
Note: This extension uses pygments to color the code. Pygments does not highlight some languages properly. Therefore, you may not get the best outcome for some languages. Sorry for the inconvenience.
Requirements (Close all LibreOffice products before installing these dependencies):
libreoffice-script-provider-python(May be optional)
Ubuntu and its derivatives users can install the dependencies using the following commands:
sudo apt install libreoffice-script-provider-python python3-pip
sudo pip3 install pygments
Windows users can install the dependencies using the following commands:
pip3 install pygments
Mac users can install it by following the instructions given at
Windows requires the environment variable:
PYTHONPATH pointing to:
Additional documentation: https://github.com/slgobinath/libreoffice-code-highlighter
- Release Description Compatibility Operating Systems License Release notes
- 1.6 Include a dialog to select custom styles 4.0 Linux, Windows, macOS GPL Download
- 1.5 Fix script error in highlighting text selection in LO Impress 4.0 Linux, Windows, macOS GPL Download
Linux, Windows, macOS
- Support automatic language detection
- Long list of languages are categorized into submenus 4.0 Linux, Windows, macOS GPL Download
Fixed error when coloring Yaml
The pygments' language lexers and styles have some conflicting tokens which caused to runtime errors in this extension. Such bugs are fixed in this release.
See GitHub issue #5Download
Code Highlighter 1.0
Tested with LO 22.214.171.124 4.0 Linux GPL
Supports 379 languages
Tested with LibreOffice Writer, Calc and Impress 126.96.36.199