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
`PrismJS` provides syntax highlighting for a lot of languages, but there are still some, which it doesn't support. This feature lets you define your own syntax highlighting rules for those unsupported languages by creating a JSON configuration file. If `Use PrismJS for syntax highlighting in editor mode` is enabled (see [PrismJS Syntax Highlighting](#prismjs-syntax-highlighting)), the rules apply in both editor and reading mode. If it is not enabled, the rules will only apply in reading mode.
625
+
626
+
To get started, create a `customPrismLanguages.json` file in your `<VaultFolder>\.obsidian\plugins\codeblock-customizer\` folder. In this file you can define the RegExes used by `PrismJS` to provide syntax highlighting for those languages. You will need to define RegExes for the [tokens](https://prismjs.com/tokens.html). There are a few examples on the official `PrismJS`[website](https://prismjs.com/extending.html).
627
+
628
+
> [!important]
629
+
> The RegExes are stored as strings in the `customPrismLanguages.json` file. This means, that you will have to escape the backslashes. So instead of one backslash (`\`), you'll have to write two (`\\`).
630
+
631
+
> [!note]
632
+
> If the JSON file is malformed or contains invalid RegExes, a notice will be shown when the plugin loads.
633
+
634
+
A sample `customPrismLanguages.json` which provides syntax highlighting for the `ma3` language would look like this:
You can enable bracket highlighting for matching and also for non-matching brackets. If you click next to a bracket (`(,),{,},[,]`), then the bracket itself, and the corresponding opening/closing bracket will be highlighted. You can set individual background, and highlight colors for matching and non-matching brackets:
0 commit comments