diff options
author | David Yip <yipdw@member.fsf.org> | 2018-02-10 02:32:39 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2018-02-10 10:36:16 -0600 |
commit | 9105b0c95428e3bbecd6f8ad106508095eed5643 (patch) | |
tree | 11ff2569e754309924eece01021bc118b5d3c3c0 /Capfile | |
parent | 53c86b29f05049d77d17a35a0ca6287174431783 (diff) |
Introduce html2text for extracting plaintext from statuses. #236.
Unlike strip_tags, html2text will preserve text present in other nodes, e.g. anchor tags: [1] pry(main)> str = '<a href="http://www.example.com">A link</a>' => "<a href=\"http://www.example.com\">A link</a>" [2] pry(main)> Html2Text.convert(str) => "[A link](http://www.example.com)" [3] pry(main)> include ActionView::Helpers::SanitizeHelper => Object [4] pry(main)> strip_tags(str) => "A link" Preserving the href of an anchor allows keyword mutes to also match on URLs, which is something that the frontend regex filter can currently do.
Diffstat (limited to 'Capfile')
0 files changed, 0 insertions, 0 deletions