slgobinath / libreoffice-code-highlighter

Code snippet highlighter for LibreOffice Writer, Calc and Impress.
https://extensions.libreoffice.org/extensions/code-highlighter
Other
131 stars 15 forks source link

libreoffice-code-highlighter

Code snippet highlighter for LibreOffice Writer and Impress.

Archived

This project is archived and no longer. There is an active fork of this project available at https://github.com/jmzambon/libreoffice-code-highlighter I highly recommend any existing or future users to switch to this forked version as I do not have time anymore to maintain this project.

Unfortunately my old LibreOffice Extensions account credentials do not work anymore (or I have the wrong one). If anyone has contacts in LibreOffice, please bring down the original extension from https://extensions.libreoffice.org/en/extensions/show/code-highlighter

INSTALLATION

Install Dependencies

Note: Close all the LibreOffice products before installing the dependencies

Linux Users

Install libreoffice-script-provider-python

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

The above command is for Ubuntu and its derivatives. Other Linux users, may not need this package. If you encounter any problems after installing the extension, please check whether you have this or similar pacakge.

Install pygments for Python 3:

sudo pip3 install pygments

Windows Users

Windows users can install pygments using the following command

pip3 install pygments

After installation, set the environment variable: PYTHONPATH pointing to: C:\Users\<UserName>\AppData\Local\Programs\Python\Python<PythonVersion>\Lib\site-packages. Here <UserName> must be replaced by your Windows username.

Check this StackOverflow Answer to see how to set PYTHONPATH on Windows.

Install Extension

Open LibreOffice, go to Tools -> Extension Manager... and add the extension codehighlighter.oxt

You can download the extension either from the official LibreOffice extensions page or from releases. If you have downloaded the codehighlighter.oxt.zip file from GitHub releases, extract it before adding to the LibreOffice.

USAGE

Menu Dialog Result

Assign keyboard shortcuts (Optional)

Open the LibreOffice Writer and goto Tools -> Customize -> Keyboard

Shortcut

LICENSE