Wombat is a Crystal binding for the well-known bat syntax highlighting library. bat
is a cat(1)
clone with wings, popular among developers for its syntax highlighting capabilities. With Wombat, you can utilize bat
's syntax highlighting functionality directly within your Crystal applications.
- bat: A well-known
cat(1)
clone with syntax highlighting capabilities. - bat-c: A C wrapper for the
bat
library.
-
Add the dependency to your
shard.yml
:dependencies: wombat: github: kojix2/wombat
-
Install the dependencies:
shards install
During installation, a postinstall
script will automatically download the static library for bat-c
into the src/ext
directory.
Retrieve and output a syntax highlighted string:
require "wombat"
highlighted = Wombat.pretty_string(%{puts "hello world"})
puts highlighted
Output the contents of a file with syntax highlighting. bat
will automatically invoke less
:
require "wombat"
Wombat.pretty_print_file("/path/to/your_file.cr")
For more details, refer to the API Documentation.
Sustainable development is important. If you encounter any issues or have suggestions for improvement, please contribute!
Your contributions are always welcome! Feel free to raise issues, submit pull requests, or suggest new features.