-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Complete collection of syntax highlighting test files #1213
Description
With all the recent news about Hacktoberfest I thought it would be a good idea to point out good beginner issues that would be actually helpful for bat. In the past years, I have actually experienced Hacktoberfest as a really great event - both as a contributor as well as a maintainer.
As of recently, bat has a set of syntax highlighting regression tests (see #1124 for more details). The main idea is that we have a large collection of test files for each and every language that bat can highlight. This way, we can make sure that we do not run into issues we had in the past where either (1) syntax highlighting for some language is suddenly not working anymore or (2) bat suddenly crashes/panics for some input (due to incompatibilities in the regex flavors in syntect and Sublime Text).
In order to add a new test file, you can follow these steps (let's take "Ruby" as an example):
- Make sure that you are running the latest version of
bat(masterorbat0.16) and thatbatis available on the path. - Find an example Ruby source file or write one yourself. If possible, the file should aim to be "comprehensive" (i.e. include a lot of the possible syntax), but this is not strictly necessary. A simple file is better than none at all. Also, the files shouldn't be gigantic.
- Save the file in
tests/syntax-tests/source/Ruby(adapt for your language). The file name could betest.rb(adapt extension) but can also be adapted if that is necessary in order forbatto highlight it correctly (e.g.Makefile). - If you have copied the file from somewhere else, please make sure that the file may be copied under the respective license and that the license is compatible with
bats license. If it requires attribution, please add aLICENSE.mdin the same folder with a text like this:The `test.rb` file has been added from [enter source here] under the following license: [add license text here] - Go to
tests/syntax-testsand run theupdate.shBash script. A new file should be generated in thehighlightedfolder (e.g.highlighted/Ruby/test.rb). - Use
catorbat --language=txtto display the content of this file and make sure that the syntax highlighting looks correct. git addthe new files in thesourcefolder as well as the autogenerated files in thehighlightedfolder.- Commit and submit a PR! Please reference this issue (Complete collection of syntax highlighting test files #1213).
List of languages / syntaxes:
- ActionScript
- Apache Conf
- AppleScript
- ARM Assembly
- AsciiDoc (Asciidoctor)
- ASP
- Assembly (x86_64)
- AWK
- Batch File
- BibTeX
- Bourne Again Shell (bash)
- C
- C#
- C++
- Cabal
- Clojure
- CMake
- CoffeeScript
- CpuInfo (
/proc/cpuinfo) - Crystal
- CSS
- CSV
- D
- Dart
- Diff
- Dockerfile
- DotENV
- Elixir
- Elm
- Erlang
- F#
- Fortran
- Friendly Interactive Shell (fish)
- fstab
- Git Attributes
- Git Config
- Git Ignore
- GLSL
- Go
- GraphQL
- Graphviz (DOT)
- Groovy
-
/etc/group - Haskell
- Highlight non-printables (
--show-all) -
/etc/hosts - HTML
- INI
- Java
- Java Server Page (JSP)
- JavaScript
- Jinja2
- JSON
- jsonnet
- Julia
- Kotlin
- LaTeX
- Less
- Lisp
- Literate Haskell
- Lua
- Makefile
- Manpage
- Markdown
- MATLAB
- MemInfo (
/proc/meminfo) - NAnt Build File
- nginx
- Nim
- Nix
- Objective-C
- Objective-C++
- OCaml
- orgmode
- Pascal
-
/etc/passwd - Perl
- PHP
- Plain Text
- PowerShell
- Protocol Buffer
- Puppet
- PureScript
- Python
- QML
- R
- Rego
- Regular Expression
-
requirements.txt - resolv (
/etc/resolv.conf) - reStructuredText
- Robot Framework.
- Ruby
- Ruby Haml
- Ruby on Rails
- Rust
- Salt State (SLS)
- Sass
- Scala
- SCSS
- SML
- SQL
- SSH Config
- SSHD Config
- Strace
- Stylus
- Swift
- syslog
- Tcl
- Terraform
- TeX
- Textile
- TOML
- TypeScript
- TypeScriptReact
- varlink
- Verilog
- VimL
- Vue Component
- XML
- YAML
It would be great if we could focus on the syntaxes in sublimehq/Packages first (marked in bold) as this would allow us to merge #1174 without having to worry (too much) about syntax highlighting regressions. Also, most of these are really popular languages, so it makes sense to have them in the test suite.