No release in over 3 years
Low commit activity in last 3 years
HTML Pipeline filter that replaces hashtags with links.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.18.2
~> 3.2.0

Runtime

 Project Readme

Hashtag filter for html-pipeline

An HTML::Pipeline filter for hashtags.

Installation

Add this line to your application's Gemfile:

gem 'html-pipeline-hashtag'

And then execute:

$ bundle

Or install it yourself as:

$ gem install html-pipeline-hashtag

Usage

Example:

require 'html/pipeline'
require 'html/pipeline/hashtag/hashtag_filter'

filters = [
  HTML::Pipeline::MarkdownFilter,
  HTML::Pipeline::HashtagFilter
]

pipeline = HTML::Pipeline.new filters

input = "Hello #world!"

context = {
  :tag_url => '/tags/%{tag}'
}

result = pipeline.call(input, context)

puts result[:output].to_html
# => "<p>Hello <a href=\"/tags/world\" target=\"_blank\" class=\"hashtag\">#world</a>!</p>\n" 

puts result[:hashtags]
# => ["world"]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mr-dxdy/html-pipeline-hashtag.