You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62-51Lines changed: 62 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,21 +3,54 @@
3
3
The application offers a Quick Look Extension for MacOS 10.15 Catalina and later for previewing source files.
4
4
Inside it uses [Highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php) to render source code with syntax highlighting.
5
5
6
+
This Application only generate the Quick Look Preview and does not provide a thumbnail service for the Finder icon.
7
+
8
+
> **Syntax Highlight is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY.**
9
+
10
+
## Installation
6
11
To use the Quick Look preview you must launch the Application at least once. In this way the Quick Look Extension will be discovered by the System and will be available in the System preferences/Extensions/Quick look.
7
12
8
13

9
14
10
-
This Application only generate the Quick Look Preview and do not provide a thumbnail service for the Finder icon.
15
+
### Download the App
16
+
Head over to the [releases](https://github.com/sbarex/SourceCodeSyntaxHighlight/releases) page to view the latest version. Move the `Syntax Highlight.app` into the `Applications` folder.
11
17
12
-
> **Syntax Highlight is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY.**
18
+
### Homebrew Cask
19
+
Syntax Highlight can also be installed via [Homebrew Cask](https://github.com/Homebrew/homebrew-cask). If you have not installed Homebrew, follow the simple instructions [here](https://brew.sh/). After that, run `brew install --cask syntax-highlight` to install the current version of Syntax Highlight.
20
+
21
+
### Note for downloading the precompiled release
22
+
The [precompiled app](https://github.com/sbarex/SourceCodeSyntaxHighlight/releases) is not notarized or signed.
23
+
24
+
When you download the precompiled app directly or via homebrew you must strip quarantine flag.
13
25
26
+
You can launch the app with right click (or ctrl click) on the app icon and choosing the open action.
27
+
28
+
Also you can execute this command from the terminal:
29
+
30
+
```
31
+
$ xattr -r -d com.apple.quarantine "FULL PATH OF THE Syntax Highlight.app (you can drag the file to get the pull path)"
32
+
```
33
+
34
+
Alternatively you can open System Preferences > Security & Privacy > General (tab) then clicking the `Open Anyway` button.
35
+
36
+
This will resolve the error of an unsigned application when launching the app.
37
+
### Build from source
38
+
39
+
The release application is compiled as universal binary (Intel and Apple Silicon processor).
40
+
41
+
After cloning remember to fetch submodules:
42
+
43
+
```
44
+
$ git submodule init
45
+
$ git submodule update
46
+
```
14
47
15
48
## File format management
16
49
17
-
The Quick Look Extension uses the [Uniform Type Identifier (UTI)](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html) to handle the supported formats (and not simply the file name extension).
50
+
The Quick Look Extension uses the [Uniform Type Identifier (UTI)](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html) to handle the supported formats (and not simply the file name extension).
18
51
Inside the definition on an UTI there are the list of extensions and mime type associated with it.
19
52
20
-
Some file types are directly associated to an UTI by the System. Other formats are registered by the owner application. In this way some extensions can be associated to multiple UTIs based on the applications currently installed. For this reason, this application supports many UTIs even if they are apparently redundant.
53
+
Some file types are directly associated to an UTI by the System. Other formats are registered by the owner application. In this way some extensions can be associated to multiple UTIs based on the applications currently installed. For this reason, this application supports many UTIs even if they are apparently redundant.
21
54
22
55
_**MacOS 10.15 Catalina does not** allow to manage some file formats including (but not limited to):_`.xml`, `.plist`, `.html`, `.ts`, `.dart`, common images (`.jpg`, `.gif`, `.png`), …
23
56
@@ -36,7 +69,7 @@ You can show _advanced settings_ using the relative command on the view menu.
36
69
37
70
### Settings
38
71
39
-
You can set the settings for all supported formats on the _General_ tab.
72
+
You can set the settings for all supported formats on the _General_ tab.
40
73
41
74
|Settings|Description|Advanced|
42
75
|:---------|:-------------| :----: |
@@ -47,7 +80,7 @@ You can set the settings for all supported formats on the _General_ tab.
47
80
|Line numbers|Allow to show the line numbers.||
48
81
|Tabs to spaces|Allow to translate tabs to spaces. Set to zero to use tabs. ||
49
82
|Extra highlight arguments|Additional standard argument passed to `highlight`. **Arguments that contains a white space must be protected inside quotes.** See `man highlight` to a list of valid arguments and plugins. Eg: `--doc-title='title with space'`|**Yes**|
50
-
|Custom CSS Style| If the render engine is set to _HTML_ allow to define a custom CSS style to override/extend the color schema.|**Yes**|
83
+
|Custom CSS Style| If the render engine is set to _HTML_ allow to define a custom CSS style to override/extend the color schema.|**Yes**|
51
84
|Interactive preview| If the render engine is set to _HTML_ enable the javascript interpreter inside the preview window. Use only if you use some `highlight` plugins that output javascript code. This option disable the possibility to move the Quick Look preview with click and drag inside the window and opening the file with a double click. |**Yes**|
52
85
|Data limit| Maximum amount of data to format, data beyond the limit is omitted. Specify 0 to not limit. This option is ignored when using a Language Server. ||
53
86
|Convert line ending| Allow to convert Windows (`CRLF`) and Mac Classic (`CR`) line ending to the Unix style (`LN`). This option is ignored when a _preprocessor_ is set or when a _Language Server_ is enabled. The line ending conversion is made my [`Dos2unix`](https://waterlan.home.xs4all.nl/dos2unix.html). |**Yes**|
@@ -84,19 +117,19 @@ When using an external Language Server the preprocessor and the data limit setti
84
117
Some format have a preconfigured custom settings to handle the data (for example java compiled class file can be decompiled before render).
85
118
86
119
### Colors
87
-
The Application has a GUI to customize the color schemas.
120
+
The Application has a GUI to customize the color schemas.
88
121
89
122

90
123
91
124
Standard schemas provided by `highlight` cannot be edited but can be duplicated and then customized.
92
125
93
-
For every tokens of a color schema you can also set a custom inline CSS style. Some basic CSS style can be handled also by the `RTF` engine, but for a best view you must choose the `HTML` render engine. For this reason the preview of the Color Schema always uses the `HTML` engine.
126
+
For every tokens of a color schema you can also set a custom inline CSS style. Some basic CSS style can be handled also by the `RTF` engine, but for a best view you must choose the `HTML` render engine. For this reason the preview of the Color Schema always uses the `HTML` engine.
94
127
95
128
Please note that the inline CSS style is not put inside the HTML `style` attribute but embedded on the global `<style>` tag inside the class style definition of the token. So you can define a custom CSS style sheet that override the inline settings.
96
129
97
-
When inserting the style of a theme token it is possible to indicate whether this should override the default values for color and font style. If you want to use the custom theme with the `RTF` rendering engine *it is required not to override the standard values*.
130
+
When inserting the style of a theme token it is possible to indicate whether this should override the default values for color and font style. If you want to use the custom theme with the `RTF` rendering engine *it is required not to override the standard values*.
98
131
99
-
Color schemas that uses inline CSS style are highlighted by an icon.
132
+
Color schemas that uses inline CSS style are highlighted by an icon.
100
133
101
134
With the advanced settings enabled you can also customize the appearance of the Language Server Protocol tokens.
102
135
@@ -106,7 +139,7 @@ With the _Inquiry window_ you can see if a specific file type is handled by the
106
139
107
140

108
141
109
-
Alternatively you can see the UTI of a file with this Terminal command:
142
+
Alternatively you can see the UTI of a file with this Terminal command:
@@ -117,39 +150,25 @@ If you found an unhandled format please send me the output of above command.
117
150
118
151
**Only the formats supported by `highlight` can be managed by this application.**
119
152
120
-
## Note for download precompiled release
121
-
The [precompiled app](https://github.com/sbarex/SourceCodeSyntaxHighlight/releases) is not notarized or signed.
122
-
When you download the precompiled app you must strip quarantine flag.
123
-
124
-
You can launch the app with right click (or ctrl click) on the app icon and choosing the open action.
125
-
126
-
Also you can execute this command from the terminal:
127
-
128
-
```
129
-
$ xattr -r -d com.apple.quarantine "FULL PATH OF THE Syntax Highlight.app (you can drag the file to get the pull path)"
130
-
```
131
-
132
-
This must resolve the error of damage application when launch the app.
133
-
134
153
## FAQ
135
154
136
155
### The Quick Look preview doesn't work
137
156
> The problem may be due to several causes:
138
157
> 1. The application is not registered under system extensions.
139
158
> 2. Another application is handling the preview instead of Syntax Highlight.
140
-
> 3. You are trying to view unsupported formats.
141
-
> 4. You are trying to view a format reserved by the system.
159
+
> 3. You are trying to view unsupported formats.
160
+
> 4. You are trying to view a format reserved by the system.
142
161
>
143
162
> If the problem affects all file formats it must related to points 1. and 2., so try one or more of these action:
144
163
> - Try the `RTF` render engine.
145
164
> - Drag the application on the trash and back to the Applications folder and then relaunch.
146
-
> - Check in the System Preferences / Extensions / Quick Look if the _Syntax Highlight_ extension is present and checked.
165
+
> - Check in the System Preferences / Extensions / Quick Look if the _Syntax Highlight_ extension is present and checked.
147
166
> - In the System Preferences / Extensions / Quick Look, drag the _Syntax Highlight_ extension on the top.
148
167
> - In the System Preferences / Extensions / Quick Look disable other extensions one at a time until you find the one that conflicts.
149
168
>
150
-
> If the problem affects only a specific format it is possible that this was registered by some application with a non-standard UTI. Check the UTI with the _Inquiry window_ and send me the value. The support for each format must be defined at compile time.
169
+
> If the problem affects only a specific format it is possible that this was registered by some application with a non-standard UTI. Check the UTI with the _Inquiry window_ and send me the value. The support for each format must be defined at compile time.
151
170
152
-
### Is it possible to enable / disable support for individual formats?
171
+
### Is it possible to enable / disable support for individual formats?
153
172
> No, Apple does not allow this functionality.
154
173
155
174
### Is it possible to add support for _xyz_ format?
@@ -161,7 +180,7 @@ This must resolve the error of damage application when launch the app.
161
180
> Some common files cannot be handled by third party extension because are reserved by the system (for example, `.xml`, `.ts`, …).
162
181
163
182
### Why the Application or the Quick Look Preview require access to the Desktop folder?
164
-
> When the _Debug option_ is enabled (on the advanced settings) on your Desktop folder will be created two files for the last preview action:
183
+
> When the _Debug option_ is enabled (on the advanced settings) on your Desktop folder will be created two files for the last preview action:
165
184
> -_colorize.log_ with the log of the highlight process.
166
185
> -_colorize.hml|rtf_ the output of the last rendering process.
167
186
@@ -171,15 +190,15 @@ This must resolve the error of damage application when launch the app.
171
190
- Icons of the custom file format are disabled on Catalina (cause an application freeze).
172
191
173
192
## Note for developers
174
-
Starting from MacOS 10.15.0 Catalina the qlgenerator APIs are deprecated.
193
+
Starting from MacOS 10.15.0 Catalina the qlgenerator APIs are deprecated.
175
194
176
195
This project consists of these components:
177
196
178
197
- A Standalone Application to set the preferences.
179
198
- A Quick Look Extension to preview the source files.
180
199
- An XPC service that generate the preview and pass the formatted data to the application or the Quick Look Preview.
181
200
182
-
MacOS 10.15 Catalina require sandboxed extension that prevent the execution of external processes (like shell script).
201
+
MacOS 10.15 Catalina require sandboxed extension that prevent the execution of external processes (like shell script).
183
202
To work around this problem, it is possible to use an XPC service that may have different security policies than the application / extension that invokes it. In this case the XPC service is not sandboxed.
184
203
185
204
The XPC service is executed automatically when requested by the application or the Quick Look Extension. After closing the Quick Look preview the process is automatically closed after some seconds releasing the resources.
@@ -189,18 +208,10 @@ The Application and the Quick Look Extension can preview files showing the forma
189
208
The settings are stored in `~/Library/Preferences/org.sbarex.SourceCodeSyntaxHighlight.plist`.
190
209
Custom themes and styles are saved in `~/Library/Application Support/Syntax Highlight`.
191
210
192
-
The application embed the [`Highlight`](http://www.andre-simon.de/doku/highlight/en/highlight.php) engine that can be build inside the Xcode project.
211
+
The application embed the [`Highlight`](http://www.andre-simon.de/doku/highlight/en/highlight.php) engine that can be build inside the Xcode project.
193
212
194
213

195
214
196
-
The release application is compiled as universal binary (Intel and Apple Silicon processor).
> Ok, so according to the [source](https://alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why/) I references above, I would do the following:
213
-
>
224
+
>
214
225
> 1. Generate the dyn content, in this case I guess its `?0=6:1=sql`.
215
226
> Though I am not sure if the `6` is correct or if it should be `7`. Where numbers are substituted as follows:
216
-
>
217
-
>
227
+
>
228
+
>
218
229
> ```
219
230
> 0: UTTypeConformsTo
220
231
> 1: public.filename-extension
@@ -233,20 +244,20 @@ $ git submodule update
233
244
> E: public.directory
234
245
> F: public.folder
235
246
> ```
236
-
>
247
+
>
237
248
> 1. Next you put this string into a custom base32 converter. E.g. [this website](https://cryptii.com/pipes/base32)
238
249
> Input: `?0=6:1=sql`
239
250
> Variant: `Custom`
240
251
> Alphabet: `abcdefghkmnpqrstuvwxyz0123456789`
241
252
> Padding: – Delete if there is any –
242
-
>
253
+
>
243
254
> 2. The output should be `h62d4rv4ge81g6pq`. If you have any trailing `=` delete it, thats the padding.
244
-
>
255
+
>
245
256
> 3. Prepend `dyn.a` and that is your final string.
246
-
>
257
+
>
247
258
> 4. What you should insert in the Info.plist is `dyn.ah62d4rv4ge81g6pq`
0 commit comments