
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
dasil003-tm_syntax_highlighting
Advanced tools
This fork of the original tm_syntax_highlithing gem was created for ruby 1.9 compatibility at a time when the
ultraviolet
gem did not support it. This was done with the spox-ultraviolet
fork, however this fork did not support
ruby 1.9.3. The original ultraviolet
gem has since released a 1.0.0 version that does support 1.9.3, and ostensibly
1.8.7 as well (though I have no plans to test that).
Important: Make sure you don't have spox-ultraviolet installed or it may supercede the regular ultraviolet and break Ruby 1.9.3
So the 2.0 version of this gem should have greatly improved compatibility, but note that the underlying libraries introduced new lang identifiers, so for instance, 'ruby' must be specified as 'source.ruby'. If you're using this plugin you wall want to audit your lang strings for correctness.
TextMate theme based highlighting for Rails 3.
This plugin was originally written by Arya Asemanfar. Rails 3 generator and 1.9.x compatibility by Gabe da Silveira.
I namespaced it as dasil003-tm_syntax_highlighting to avoid interference with the original.
On Ruby 1.9 you simply install the gem:
$ gem install dasil003-tm_syntax_highlighting
On Ruby 1.8 you will need to install Oniguruma (http://www.geocities.jp/kosako3/oniguruma/). I haven't
actually tested this gem under Oniguruma, but ultraviolet
claims support, so I will too. If there is a problem in
1.8, please feel free to submit a patch.
It just copies all the syntax files from ultraviolet into your stylesheets directory. I haven't had time to figure out the Thor setup in Rails 3, so sue me.
# generate all the ultraviolet css theme files in public/stylesheets/syntax/*
$ rails generate syntax_css
The plugin adds 2 view helper methods: code
and syntax_css
code(some_ruby_code, :theme => "twilight", :lang => "source.ruby", :line_numbers => true)
lang
and line_numbers
are optional. lang
will default to plain_text and line_numbers
will default to true.
It is HIGHLY recommended that you fragment cache or some other type of caching for code fragments because ultraviolet
is fairly slow.
Theme can be an array, and one will be chosen at random.
You can set defaults in an initializer:
# config/initializers/tm_syntax_config.rb
TmSyntaxHighlighting.defaults = {:theme => "sunburst", :line_numbers => true, :lang => "source.ruby"}
Again, theme can be an array and will be chosen at random.
The syntax_css method will include the stylesheet tags for the themes. You can call it with a theme name
syntax_css("twilight")
or if you call it with no options, it will include all the css files for the themes used in this request
code(some_ruby_code, :theme => "twilight")
code(some_more_ruby_code, :theme => "sunburst")
...
syntax_css # yields stylesheet tags for both twilight and sunburst
FAQs
Unknown package
We found that dasil003-tm_syntax_highlighting demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.