Add support for plaintext
I think all of those should work and simply not highlight the text:
silicon -l txt
silicon -l text
silicon -l plaintext
I just bumped into a usecase for this as well. Has anyone found a workaround yet?
I tried by putting the bat syntax-file for plaintext (https://github.com/sublimehq/Packages/blob/759d6eed9b4beed87e602a23303a121c3a6c2fb3/Text/Plain%20text.tmLanguage) inside ~/.config/silicon/syntaxes and ran silicon --build-cache, but it does not recognise it.
For my usecase at the moment using markdown as language was enough, but it won't always be. Hopefully this could become a feature, sadly I cannot do this myself, as Rust is not something I can.
@BWindey and anyone else wanting to accomplish this, here is how you can add plain text support to Silicon:
- Navigate to Silicon's config directory[^1].
- Create two subdirectories:
themesandsyntaxes. - In the
syntaxesdirectory, create a file namedtext.sublime-syntax. - Paste the following into the file:
%YAML 1.2
---
name: Plain Text
scope: source.txt
file_extensions:
- txt
contexts:
main:
- match: '.'
scope: text.txt
- Navigate back to the config directory and run
silicon --build-cache. - Test by running Silicon on a
.txtfile or by using--language txtor--language "Plain Text".
You can add entries to the file_extensions key in the above YAML to make Silicon auto-recognize other file types as plain text (like READMEs or license files). You can also change the name key to something else (e.g. name: Normal Text would mean using --language "Normal Text" when running Silicon.
[^1]: This is the parent directory displayed when running silicon --config-file. It is %USERPROFILE%\AppData\Local\silicon on Windows, and probably ~/config/silicon on Linux.