An extension for Redcarpet that supports abbreviations. So this:
I'm pretty sure I'm not using this acronym right but hey YOLO.
*[YOLO]: You Only Live Once
Becomes this:
I'm pretty sure I'm not using this acronym right but hey <abbr title="You Only Live Once">YOLO</abbr>.
If you're thinking this would be better in Redcarpet, yes I totally agree, but I don't know C.
Add this line to your application's Gemfile:
gem "redcarpet-abbreviations"
And then execute:
$ bundle
Or install it yourself as:
$ gem install redcarpet-abbreviations
Just include it in your renderer.
class HTMLWithAbbreviations < Redcarpet::Render::HTML
include Redcarpet::Render::HTMLAbbreviations
end
Remember to call super
if your renderer has its own preprocess
method, otherwise it will override the included preprocess
method.
class HTMLWithAbbreviations < Redcarpet::Render::HTML
include Redcarpet::Render::HTMLAbbreviations
def preprocess(document)
document = super(document)
# ...
end
end
- Fork it ( https://github.com/brandonweiss/redcarpet-abbreviations/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request