zfben_extend
A tool to extend ruby string.
Install
gem 'zfben_extend'
Use
ZfbenExtend::String.to_html('text http://link #tag [email protected] @user text', tag_url: '/tagurl/', user_url: '/userurl/')
# => 'text <a href="http://link">http://link</a> <a href="/tagurl/tag">#tag</a> <a href="mailto:[email protected]">[email protected]</a> <a href="/userurl/user">@user</a> text'
ZfbenExtend::String.to_cnbr('a.b', chars: /\./, br: '<hr />')
# => 'a.<hr />b'
ZfbenExtend::String.markdown(' a')
# => <div class=\"CodeRay\">\n <div class=\"code\"><pre>a\n</pre></div>\n</div>\n
ZfbenExtend::String.markdown("```ruby\n a\n```")
# => <div class=\"CodeRay\">\n <div class=\"code\"><pre> a\n</pre></div>\n</div>\n
See more at https://github.com/benz303/zfben_extend/blob/master/test/string_test.rb