@@ -12,99 +12,25 @@ Install pygments for Python 3:
12
12
sudo pip3 install pygments
13
13
```
14
14
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 `
24
16
17
+ ## Assign keyboard shortcut to selected languages
25
18
Open the LibreOffice Writer and goto Tools -> Customize -> Keyboard
26
19
- Select the LibreOffice option button (Available on top left corner)
27
20
- 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
29
22
- Click on the Modify button to set the shortcut
30
23
<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 " >
32
25
</p >
33
26
34
27
## Usage
35
- ### LibreOffice Impress
36
- - Open LibreOffice Impress.
28
+ - Open LibreOffice.
37
29
- Insert a Text Box (Insert -> Text Box).
38
30
- 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.
43
31
- 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)
62
33
63
34
<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 " >
65
36
</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