I need to write a lot of class courses presentations to my programming class, and I constantly need to show source code (mainly C
Update: I have released this macro as a LibreOffice extension. You can install it from the official site: Code Highlighter
I had the same problem but for Java and finally I found a native solution using Python macro which is tested in LibreOffice 5.
Step 1: Install libreoffice-script-provider-python:
sudo apt-get install libreoffice-script-provider-python
Step 2: Install pygments for Python 3:
sudo pip3 install python3-pygments
Step 3: Download Highlight.py
Step 4: Copy the Highlight.py to /usr/lib/libreoffice/share/Scripts/python/
sudo cp Highlight.py /usr/lib/libreoffice/share/Scripts/python/
Step 5: Set the Read-Only permission to the script.
sudo chmod 0444 /usr/lib/libreoffice/share/Scripts/python/Highlight.py
Step 6: Open the LibreOffice Writer and goto Tools -> Customize -> Keyboard
code-
code-
UPDATE:
I have added custom style support to this extension. Use code-
for default style and code-
for custom style. Available styles are listed in my Git Hub page.
For example Code-Java-Emacs
will colorize the Java code using Emacs style.
For more details, visit to the Git Hub link: libreoffice-code-highlighter