Wombat


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.
About bat
- bat: A well-known
cat(1)clone with syntax highlighting capabilities. - bat-c: A C wrapper for the
batlibrary.
Installation
-
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.
Usage
Obtain a Syntax Highlighted String
Retrieve and output a syntax highlighted string:
require "wombat"
highlighted = Wombat.pretty_string(%{puts "hello world"})
puts highlighted
Output a Syntax Highlighted File
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.
Development
Sustainable development is important. If you encounter any issues or have suggestions for improvement, please contribute!
Contributing
Your contributions are always welcome! Feel free to raise issues, submit pull requests, or suggest new features.