Skip to content
This repository was archived by the owner on Aug 20, 2023. It is now read-only.

Commit 02c9ce4

Browse files
committed
Code Highlighter v1.0
1 parent bfe1ac5 commit 02c9ce4

File tree

11 files changed

+6652
-81
lines changed

11 files changed

+6652
-81
lines changed

LICENSE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Code Highligher is a LibreOffice extension to highlight code snippets
2+
over 350 languages.
3+
4+
Copyright (C) 2017 Gobinath
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.

README.md

Lines changed: 7 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -12,99 +12,25 @@ Install pygments for Python 3:
1212
sudo pip3 install pygments
1313
```
1414

15-
Copy the Highlight.py to /usr/lib/libreoffice/share/Scripts/python/
16-
```
17-
sudo cp Highlight.py /usr/lib/libreoffice/share/Scripts/python/
18-
```
19-
20-
Set the Read-Only permission to the script.
21-
```
22-
sudo chmod 0444 /usr/lib/libreoffice/share/Scripts/python/Highlight.py
23-
```
15+
Open LibreOffice, go to `Tools` -> `Extension Manager...` and add the extension `codehighlighter.oxt`
2416

17+
## Assign keyboard shortcut to selected languages
2518
Open the LibreOffice Writer and goto Tools -> Customize -> Keyboard
2619
- Select the LibreOffice option button (Available on top left corner)
2720
- Select any desired shortcut
28-
- Select *share/Highlight/Highlight_source_code* under the Functions Category
21+
- Select `user/codehighlighter.oxt/highlight/highlight_<language-name>_default` under the `LibreOffice Macros` Category
2922
- Click on the Modify button to set the shortcut
3023
<p align="center">
31-
<img src="https://raw.githubusercontent.com/slgobinath/libreoffice-code-highlighter/master/Screenshots/Assign_Keyboard_Shortcut.png" align="center" width="600">
24+
<img src="https://raw.githubusercontent.com/slgobinath/libreoffice-code-highlighter/master/screenshots/code-highlighter-shortcut.png" align="center" width="600">
3225
</p>
3326

3427
## Usage
35-
### LibreOffice Impress
36-
- Open LibreOffice Impress.
28+
- Open LibreOffice.
3729
- Insert a Text Box (Insert -> Text Box).
3830
- Copy and paste any code snippet into that Text Box.
39-
- Create a new Style (Right click on an existing style -> New...)
40-
- Name the Style using the following case insensitive format: code-\<language\> (Default style)
41-
- If you want to use custom styles, append the style at the end like: code-\<language\>-\<style\>
42-
- Apply the style to your code snippet Text Box.
4331
- Select the Text Box.
44-
- Use your shortcut keys to execute the macro.
45-
46-
<p align="center">
47-
<img src="https://github.com/slgobinath/libreoffice-code-highlighter/blob/master/Screenshots/Impress_New_Style.png" align="center" width="600">
48-
</p>
49-
<p align="center">
50-
<img src="https://github.com/slgobinath/libreoffice-code-highlighter/blob/master/Screenshots/Impress_Apply_Style.png" align="center" width="600">
51-
</p>
52-
53-
### LibreOffice Writer/Calc
54-
- Open LibreOffice Writer/Calc.
55-
- Insert a Text Box (Insert -> Text Box).
56-
- Copy and paste any code snippet into that Text Box.
57-
- Right click on the Text Box and select 'Description'.
58-
- Add a description in the following case insensitive format: code-\<language\> (Default style)
59-
- If you want to use custom styles, append the style at the end like: code-\<language\>-\<style\>
60-
- Select the Text Box
61-
- Use your shortcut keys to execute the macro.
32+
- Tools -> Highlight Code -> Select the language (Or use the shortcut key)
6233

6334
<p align="center">
64-
<img src="https://github.com/slgobinath/libreoffice-code-highlighter/blob/master/Screenshots/Writter_Add_Description.png" align="center" width="600">
35+
<img src="https://raw.githubusercontent.com/slgobinath/libreoffice-code-highlighter/master/screenshots/code-highlighter-menu.png" align="center" width="600">
6536
</p>
66-
67-
## Supported Languages
68-
Since this macro uses Python pygments syntax highlighter, it supports all the languages which are supported by pygments. Please visit to the pygments' site to see the list of languages.
69-
70-
[Supported languages](http://pygments.org/languages)
71-
72-
## Supported Styles
73-
Pygments ships some builtin styles which are maintained by the Pygments team. To get a list of known styles you can use this Python script:
74-
75-
```
76-
from pygments.styles import get_all_styles
77-
print(list(get_all_styles()))
78-
```
79-
80-
**Some built-in styles:**
81-
- monokai
82-
- manni
83-
- rrt
84-
- perldoc
85-
- borland
86-
- colorful
87-
- default
88-
- murphy
89-
- vs
90-
- trac
91-
- tango
92-
- fruity
93-
- autumn
94-
- bw
95-
- emacs
96-
- vim
97-
- pastie
98-
- friendly
99-
- native
100-
101-
<p align="center">
102-
<img src="https://github.com/slgobinath/libreoffice-code-highlighter/blob/master/Screenshots/Writter_Emacs_Style.png" align="center" width="600">
103-
</p>
104-
105-
For more details: [Pygments Styles](http://pygments.org/docs/styles/)
106-
107-
## Credits
108-
This macro is developed using the following two sources:
109-
- [impress-code-highlighter](https://github.com/stummjr/impress-code-highlighter)
110-
- [Python Syntax Highlighting in OpenOffice Impress](http://code.activestate.com/recipes/576796-python-syntax-highlighting-in-openoffice-impress)

0 commit comments

Comments
 (0)