Skip to content

Commit 4b582b6

Browse files
authored
Merge pull request #75 from AdamXweb/update-readme
Update Readme with installation instructions
2 parents bf98a84 + 572c791 commit 4b582b6

File tree

2 files changed

+62
-51
lines changed

2 files changed

+62
-51
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,54 @@
33
The application offers a Quick Look Extension for MacOS 10.15 Catalina and later for previewing source files.
44
Inside it uses [Highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php) to render source code with syntax highlighting.
55

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
611
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.
712

813
![System preferences/Extensions](extensions.png)
914

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.
1117

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.
1325

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+
```
1447

1548
## File format management
1649

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).
1851
Inside the definition on an UTI there are the list of extensions and mime type associated with it.
1952

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.
2154

2255
_**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`), …
2356

@@ -36,7 +69,7 @@ You can show _advanced settings_ using the relative command on the view menu.
3669

3770
### Settings
3871

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.
4073

4174
|Settings|Description|Advanced|
4275
|:---------|:-------------| :----: |
@@ -47,7 +80,7 @@ You can set the settings for all supported formats on the _General_ tab.
4780
|Line numbers|Allow to show the line numbers.||
4881
|Tabs to spaces|Allow to translate tabs to spaces. Set to zero to use tabs. ||
4982
|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**|
5184
|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**|
5285
|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. ||
5386
|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
84117
Some format have a preconfigured custom settings to handle the data (for example java compiled class file can be decompiled before render).
85118

86119
### Colors
87-
The Application has a GUI to customize the color schemas.
120+
The Application has a GUI to customize the color schemas.
88121

89122
![Color schema editor](theme_editor.png)
90123

91124
Standard schemas provided by `highlight` cannot be edited but can be duplicated and then customized.
92125

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.
94127

95128
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.
96129

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*.
98131

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.
100133

101134
With the advanced settings enabled you can also customize the appearance of the Language Server Protocol tokens.
102135

@@ -106,7 +139,7 @@ With the _Inquiry window_ you can see if a specific file type is handled by the
106139

107140
![Inquiry window](inquiry.png)
108141

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:
110143

111144
```
112145
$ mdls -name kMDItemContentType -name kMDItemContentTypeTree filename.ext
@@ -117,39 +150,25 @@ If you found an unhandled format please send me the output of above command.
117150

118151
**Only the formats supported by `highlight` can be managed by this application.**
119152

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-
134153
## FAQ
135154

136155
### The Quick Look preview doesn't work
137156
> The problem may be due to several causes:
138157
> 1. The application is not registered under system extensions.
139158
> 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.
142161
>
143162
> If the problem affects all file formats it must related to points 1. and 2., so try one or more of these action:
144163
> - Try the `RTF` render engine.
145164
> - 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.
147166
> - In the System Preferences / Extensions / Quick Look, drag the _Syntax Highlight_ extension on the top.
148167
> - In the System Preferences / Extensions / Quick Look disable other extensions one at a time until you find the one that conflicts.
149168
>
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.
151170
152-
### Is it possible to enable / disable support for individual formats?
171+
### Is it possible to enable / disable support for individual formats?
153172
> No, Apple does not allow this functionality.
154173
155174
### 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.
161180
> Some common files cannot be handled by third party extension because are reserved by the system (for example, `.xml`, `.ts`, …).
162181
163182
### 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:
165184
> - _colorize.log_ with the log of the highlight process.
166185
> - _colorize.hml|rtf_ the output of the last rendering process.
167186
@@ -171,15 +190,15 @@ This must resolve the error of damage application when launch the app.
171190
- Icons of the custom file format are disabled on Catalina (cause an application freeze).
172191

173192
## 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.
175194

176195
This project consists of these components:
177196

178197
- A Standalone Application to set the preferences.
179198
- A Quick Look Extension to preview the source files.
180199
- An XPC service that generate the preview and pass the formatted data to the application or the Quick Look Preview.
181200

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).
183202
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.
184203

185204
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
189208
The settings are stored in `~/Library/Preferences/org.sbarex.SourceCodeSyntaxHighlight.plist`.
190209
Custom themes and styles are saved in `~/Library/Application Support/Syntax Highlight`.
191210

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.
193212

194213
![highlight info](about_highlight.png)
195214

196-
The release application is compiled as universal binary (Intel and Apple Silicon processor).
197-
198-
After cloning remember to fetch submodules:
199-
200-
```
201-
$ git submodule init
202-
$ git submodule update
203-
```
204215

205216
### Info about decoding dynamic uti identifiers:
206217

@@ -210,11 +221,11 @@ $ git submodule update
210221
- https://www.cocoanetics.com/2012/09/fun-with-uti/
211222
- **https://github.com/whomwah/qlstephen/issues/87#issuecomment-694528728**:
212223
> 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+
>
214225
> 1. Generate the dyn content, in this case I guess its `?0=6:1=sql`.
215226
> 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+
>
218229
> ```
219230
> 0: UTTypeConformsTo
220231
> 1: public.filename-extension
@@ -233,20 +244,20 @@ $ git submodule update
233244
> E: public.directory
234245
> F: public.folder
235246
> ```
236-
>
247+
>
237248
> 1. Next you put this string into a custom base32 converter. E.g. [this website](https://cryptii.com/pipes/base32)
238249
> Input: `?0=6:1=sql`
239250
> Variant: `Custom`
240251
> Alphabet: `abcdefghkmnpqrstuvwxyz0123456789`
241252
> Padding: – Delete if there is any –
242-
>
253+
>
243254
> 2. The output should be `h62d4rv4ge81g6pq`. If you have any trailing `=` delete it, thats the padding.
244-
>
255+
>
245256
> 3. Prepend `dyn.a` and that is your final string.
246-
>
257+
>
247258
> 4. What you should insert in the Info.plist is `dyn.ah62d4rv4ge81g6pq`
248-
>
249-
>
259+
>
260+
>
250261
> ```
251262
> <key>LSItemContentTypes</key>
252263
> <array>

0 commit comments

Comments
 (0)