Giter Club home page Giter Club logo

hylite's Introduction

Hylite

Syntax Highlighting for scripters.

It has a simple binary-interface and Ruby interface that tries to find a syntax highlighting tool on your machine and then highlight your code using that tool.

The intent:

  1. Allow a script to find and use an existing syntax highlighter without needing to add one as a dependency.
  2. All syntax highlighting that I've seen have stupidly difficult interfaces (often buggy, difficult to discover, the obvious use case requires non-obvious configuration which is difficult to discover and has mediocre defaults), the intent here is to improve discoverability, have it do the obvious thing by default, and choose reasonable defaults so that you rarely have to configure it.
  3. If you find ways that it doesn't do this, let me know. Eg I didn't test the themes on a light background to make sure they look good there. That might make the defaults only work well on dark backgrounds.

If you're not scripting, you'll want to use one of the libraries this tool wraps:

Todo

  • Allow user to pass a filename as that's a pretty obvious way to use it, and that's probably a nicer interface for non-Ruby projects.
  • Possibly allow it to guess the default (eg Rouge will do this)

Interface

# Simplest interface
$ cat my_code.rb | hylite

# Highlight other languages
$ cat my_code.c | hylite --lang c

Development

Assuming a working Ruby development environment (try chruby if you don't have one).

# Install Bundler for dependency management, if you don't already have it
$ gem install bundler

# Tell bundler to install the dev dependencies
$ bundle install

# Run the tests
$ mrspec

License

WTFPL, Just do what the fuck you want to.

NO WARRANTY.

hylite's People

Contributors

joshcheek avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

hylite's Issues

fkn broke on me :(

$ cache curl -s 'https://raw.githubusercontent.com/toddmotto/public-apis/2658d92fd8e3f8bfa2002a8a799ada2b29b55405/README.md' | marked --tokens --tables --gfm | jq 'map(select(.type == "table"))' | ruby -rjson -rpp -e 'pp JSON.parse($stdin.read, symbolize_names: true).first' | hylite
/Users/josh/.gem/ruby/2.4.0/gems/rouge-1.11.1/lib/rouge/formatters/terminal256.rb:16:in `initialize': undefined method `[]' for Rouge::Themes::Monokai:Class (NoMethodError)
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/lib/hylite/hyliters.rb:41:in `new'
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/lib/hylite/hyliters.rb:41:in `call'
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/lib/hylite.rb:23:in `call'
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/lib/hylite.rb:5:in `call'
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/lib/hylite/cli.rb:63:in `ensure_evaluated'
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/lib/hylite/cli.rb:43:in `success?'
	from /Users/josh/.gem/ruby/2.4.0/gems/hylite-1.1.1/bin/hylite:7:in `<top (required)>'
	from /Users/josh/.gem/ruby/2.4.0/bin/hylite:22:in `load'
	from /Users/josh/.gem/ruby/2.4.0/bin/hylite:22:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.