Skip to content

Complete collection of syntax highlighting test files #1213

@sharkdp

Description

@sharkdp

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

  1. Make sure that you are running the latest version of bat (master or bat 0.16) and that bat is available on the path.
  2. 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.
  3. Save the file in tests/syntax-tests/source/Ruby (adapt for your language). The file name could be test.rb (adapt extension) but can also be adapted if that is necessary in order for bat to highlight it correctly (e.g. Makefile).
  4. 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 a LICENSE.md in 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]
    
  5. Go to tests/syntax-tests and run the update.sh Bash script. A new file should be generated in the highlighted folder (e.g. highlighted/Ruby/test.rb).
  6. Use cat or bat --language=txt to display the content of this file and make sure that the syntax highlighting looks correct.
  7. git add the new files in the source folder as well as the autogenerated files in the highlighted folder.
  8. 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
  • Email
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions