This extension highlights the code snippets over 350 languages in LibreOffice.
latest release: 2020-03-05 22:50:06
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 1.4Download 1.3 Support C++ 4.0 Linux, Windows, macOS GPL
Support C++Download 1.2 - Support automatic language detection
- Long list of languages are categorized into submenus 4.0 Linux, Windows, macOS GPL Download 1.1 Fixed error when coloring Yaml 4.0 Linux GPL
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 1.0 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