pax_global_header00006660000000000000000000000064143223360320014510gustar00rootroot0000000000000052 comment=84c75b3d123c5219238c5f01c2b7de7ea73755cd html-pipeline-2.14.3/000077500000000000000000000000001432233603200143465ustar00rootroot00000000000000html-pipeline-2.14.3/.github/000077500000000000000000000000001432233603200157065ustar00rootroot00000000000000html-pipeline-2.14.3/.github/FUNDING.yml000066400000000000000000000001351432233603200175220ustar00rootroot00000000000000github: gjtorikian patreon: gjtorikian open_collective: garen-torikian issuehunt: gjtorikian html-pipeline-2.14.3/.gitignore000066400000000000000000000002741432233603200163410ustar00rootroot00000000000000*.gem *.rbc .bundle .config .yardoc Gemfile.lock gemfiles/*.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp exec/* vendor/gemshtml-pipeline-2.14.3/.travis.yml000066400000000000000000000014311432233603200164560ustar00rootroot00000000000000language: ruby cache: bundler bundler_args: --path ../../vendor/bundle addons: apt: sources: - libicu-dev - kalakris-cmake packages: - cmake script: bundle exec rake gemfile: - gemfiles/rails_6.gemfile - gemfiles/rails_5.gemfile - gemfiles/rails_4.gemfile - gemfiles/rails_3.gemfile rvm: - 2.4.6 - 2.3.8 - 2.5.7 - ruby-head matrix: fast_finish: true allow_failures: - rvm: ruby-head exclude: - gemfile: gemfiles/rails_6.gemfile rvm: 2.4.6 - gemfile: gemfiles/rails_6.gemfile rvm: 2.3.8 - gemfile: gemfiles/rails_4.gemfile rvm: 2.5.7 - gemfile: gemfiles/rails_4.gemfile rvm: 2.4.6 - gemfile: gemfiles/rails_3.gemfile rvm: 2.5.7 - gemfile: gemfiles/rails_3.gemfile rvm: 2.4.6 html-pipeline-2.14.3/Appraisals000066400000000000000000000004321432233603200163670ustar00rootroot00000000000000# frozen_string_literal: true appraise 'rails-3' do gem 'rack', '< 2' gem 'rails', '3.2.22.2' end appraise 'rails-4' do gem 'rack', '< 2' gem 'rails', '~> 4.2.6' end appraise 'rails-5' do gem 'rails', '~> 5.0.0' end appraise 'rails-6' do gem 'rails', '~> 6.0.0' end html-pipeline-2.14.3/CHANGELOG.md000066400000000000000000001400751432233603200161660ustar00rootroot00000000000000# Changelog ## [Unreleased](https://github.com/gjtorikian/html-pipeline/tree/HEAD) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.14.2...HEAD) **Closed issues:** - Allow vertical-align [\#366](https://github.com/gjtorikian/html-pipeline/issues/366) - Since bump 2.14.2 builds are failing [\#363](https://github.com/gjtorikian/html-pipeline/issues/363) **Merged pull requests:** - Replace EscapeUtils.escape\_html with CGI.escape\_html [\#365](https://github.com/gjtorikian/html-pipeline/pull/365) ([ramhoj](https://github.com/ramhoj)) ## [v2.14.2](https://github.com/gjtorikian/html-pipeline/tree/v2.14.2) (2022-06-12) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.14.1...v2.14.2) **Merged pull requests:** - handle invalid data urls in absolute source filter [\#361](https://github.com/gjtorikian/html-pipeline/pull/361) ([glaszig](https://github.com/glaszig)) ## [v2.14.1](https://github.com/gjtorikian/html-pipeline/tree/v2.14.1) (2022-03-31) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.13.2...v2.14.1) **Closed issues:** - 2.14.0 is disconnected [\#358](https://github.com/gjtorikian/html-pipeline/issues/358) - I would love to use the vscode codicon.ttf in my readme.md [\#356](https://github.com/gjtorikian/html-pipeline/issues/356) - Html-pipeline [\#355](https://github.com/gjtorikian/html-pipeline/issues/355) - Canalizacion de HTML [\#354](https://github.com/gjtorikian/html-pipeline/issues/354) - Change branch name off of `master` [\#340](https://github.com/gjtorikian/html-pipeline/issues/340) - New feature request: team mention filter [\#311](https://github.com/gjtorikian/html-pipeline/issues/311) - code in header produce invalid anchor [\#308](https://github.com/gjtorikian/html-pipeline/issues/308) - Stop "camo"ing "github.io" [\#305](https://github.com/gjtorikian/html-pipeline/issues/305) - A filter to produce diffs with syntax highlighting in html, maybe. [\#270](https://github.com/gjtorikian/html-pipeline/issues/270) - Require pygments.rb or remove Pygments references [\#235](https://github.com/gjtorikian/html-pipeline/issues/235) - Allow ᴀʀɪᴀ attributes for blind people. [\#219](https://github.com/gjtorikian/html-pipeline/issues/219) - 'lexer' is removed from github-linguist [\#217](https://github.com/gjtorikian/html-pipeline/issues/217) - Please document how to use the html-pipeline binary without command‐line arguments! [\#213](https://github.com/gjtorikian/html-pipeline/issues/213) - PHP syntax highlight [\#212](https://github.com/gjtorikian/html-pipeline/issues/212) ## [v2.13.2](https://github.com/gjtorikian/html-pipeline/tree/v2.13.2) (2020-12-04) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.13.1...v2.13.2) **Merged pull requests:** - Fix custom renderer with unsafe option missing pre lang [\#341](https://github.com/gjtorikian/html-pipeline/pull/341) ([kazk](https://github.com/kazk)) ## [v2.13.1](https://github.com/gjtorikian/html-pipeline/tree/v2.13.1) (2020-12-02) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.14.0...v2.13.1) **Merged pull requests:** - Replace whitelist with more neutral language [\#339](https://github.com/gjtorikian/html-pipeline/pull/339) ([tancnle](https://github.com/tancnle)) - allows progress tags to be used [\#338](https://github.com/gjtorikian/html-pipeline/pull/338) ([pedrozath](https://github.com/pedrozath)) - Updated English [\#337](https://github.com/gjtorikian/html-pipeline/pull/337) ([BhuvnendraPratapSingh](https://github.com/BhuvnendraPratapSingh)) - Make AutolinkFilter configurable [\#335](https://github.com/gjtorikian/html-pipeline/pull/335) ([mnishiguchi](https://github.com/mnishiguchi)) ## [v2.14.0](https://github.com/gjtorikian/html-pipeline/tree/v2.14.0) (2020-08-11) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.13.0...v2.14.0) ## [v2.13.0](https://github.com/gjtorikian/html-pipeline/tree/v2.13.0) (2020-05-28) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.12.3...v2.13.0) **Closed issues:** - Jch html-pipeline [\#330](https://github.com/gjtorikian/html-pipeline/issues/330) - console rendering of slash continued multi-line commands [\#328](https://github.com/gjtorikian/html-pipeline/issues/328) - Allow backslash-escape for @mention and emoji [\#232](https://github.com/gjtorikian/html-pipeline/issues/232) **Merged pull requests:** - Allow `role` attributes in html tags [\#332](https://github.com/gjtorikian/html-pipeline/pull/332) ([eric-wieser](https://github.com/eric-wieser)) - Update README.md [\#329](https://github.com/gjtorikian/html-pipeline/pull/329) ([Mihail354](https://github.com/Mihail354)) - Update CHANGELOG from 2.12.1 to 2.12.3 [\#326](https://github.com/gjtorikian/html-pipeline/pull/326) ([JuanitoFatas](https://github.com/JuanitoFatas)) ## [v2.12.3](https://github.com/gjtorikian/html-pipeline/tree/v2.12.3) (2019-12-19) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.12.2...v2.12.3) **Merged pull requests:** - Improves syntax highlight filter [\#325](https://github.com/gjtorikian/html-pipeline/pull/325) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Reuse found lexer in SyntaxHighlightFilter [\#324](https://github.com/gjtorikian/html-pipeline/pull/324) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Fix link of Rouge CSS Theme [\#323](https://github.com/gjtorikian/html-pipeline/pull/323) ([JuanitoFatas](https://github.com/JuanitoFatas)) ## [v2.12.2](https://github.com/gjtorikian/html-pipeline/tree/v2.12.2) (2019-11-14) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.12.1...v2.12.2) **Closed issues:** - Changing the list of commonmarker extensions with custom renderer is broken [\#321](https://github.com/gjtorikian/html-pipeline/issues/321) **Merged pull requests:** - Allow bad tags [\#322](https://github.com/gjtorikian/html-pipeline/pull/322) ([gjtorikian](https://github.com/gjtorikian)) ## [v2.12.1](https://github.com/gjtorikian/html-pipeline/tree/v2.12.1) (2019-11-13) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.12.0...v2.12.1) **Closed issues:** - Where is this inserting the p tag? [\#317](https://github.com/gjtorikian/html-pipeline/issues/317) - Update CHANGELOG [\#315](https://github.com/gjtorikian/html-pipeline/issues/315) **Merged pull requests:** - Make this list a const [\#320](https://github.com/gjtorikian/html-pipeline/pull/320) ([gjtorikian](https://github.com/gjtorikian)) - Add Rails 6.0 to appraisals [\#319](https://github.com/gjtorikian/html-pipeline/pull/319) ([smudge](https://github.com/smudge)) - Add ability to pass custom renderer to MarkdownFilter [\#318](https://github.com/gjtorikian/html-pipeline/pull/318) ([gjtorikian](https://github.com/gjtorikian)) - Update changelog [\#316](https://github.com/gjtorikian/html-pipeline/pull/316) ([sj26](https://github.com/sj26)) ## [v2.12.0](https://github.com/gjtorikian/html-pipeline/tree/v2.12.0) (2019-08-12) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.11.1...v2.12.0) **Merged pull requests:** - Team mention filter [\#314](https://github.com/gjtorikian/html-pipeline/pull/314) ([indigok](https://github.com/indigok)) ## [v2.11.1](https://github.com/gjtorikian/html-pipeline/tree/v2.11.1) (2019-07-18) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.11.0...v2.11.1) **Merged pull requests:** - Freeze string literals in Ruby 2.3 and beyond [\#313](https://github.com/gjtorikian/html-pipeline/pull/313) ([ashmaroli](https://github.com/ashmaroli)) - Avoid YARD warning: Unknown tag @mention [\#309](https://github.com/gjtorikian/html-pipeline/pull/309) ([olleolleolle](https://github.com/olleolleolle)) ## [v2.11.0](https://github.com/gjtorikian/html-pipeline/tree/v2.11.0) (2019-04-06) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.10.0...v2.11.0) **Merged pull requests:** - CI: Use latest 2.4 [\#310](https://github.com/gjtorikian/html-pipeline/pull/310) ([olleolleolle](https://github.com/olleolleolle)) - CamoFilter: use String\#unpack to hexencode URLs [\#256](https://github.com/gjtorikian/html-pipeline/pull/256) ([glaszig](https://github.com/glaszig)) ## [v2.10.0](https://github.com/gjtorikian/html-pipeline/tree/v2.10.0) (2019-01-06) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.9.2...v2.10.0) **Closed issues:** - RFC5122: XMPP URI [\#289](https://github.com/gjtorikian/html-pipeline/issues/289) **Merged pull requests:** - Add XMPP URI \#289 [\#307](https://github.com/gjtorikian/html-pipeline/pull/307) ([Neustradamus](https://github.com/Neustradamus)) ## [v2.9.2](https://github.com/gjtorikian/html-pipeline/tree/v2.9.2) (2019-01-04) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.9.1...v2.9.2) **Closed issues:** - Why isn't \ whitelisted by default? [\#183](https://github.com/gjtorikian/html-pipeline/issues/183) **Merged pull requests:** - Whitelist various inline semantic/formatting tags [\#306](https://github.com/gjtorikian/html-pipeline/pull/306) ([chris-morgan](https://github.com/chris-morgan)) ## [v2.9.1](https://github.com/gjtorikian/html-pipeline/tree/v2.9.1) (2018-11-13) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.9.0...v2.9.1) **Merged pull requests:** - Render irc and ircs URLs [\#191](https://github.com/gjtorikian/html-pipeline/pull/191) ([frozencemetery](https://github.com/frozencemetery)) ## [v2.9.0](https://github.com/gjtorikian/html-pipeline/tree/v2.9.0) (2018-11-08) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.8.4...v2.9.0) **Closed issues:** - New feature request for hashtags \# filter [\#301](https://github.com/gjtorikian/html-pipeline/issues/301) - Whitelist srcset for responsive images [\#233](https://github.com/gjtorikian/html-pipeline/issues/233) **Merged pull requests:** - Adds `UNSAFE` option to CommonMarker usage where needed [\#304](https://github.com/gjtorikian/html-pipeline/pull/304) ([diachini](https://github.com/diachini)) - Fix one more missing freeze [\#300](https://github.com/gjtorikian/html-pipeline/pull/300) ([stanhu](https://github.com/stanhu)) ## [v2.8.4](https://github.com/gjtorikian/html-pipeline/tree/v2.8.4) (2018-07-24) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.8.3...v2.8.4) **Merged pull requests:** - Freeze all elements in HTML::Pipeline::SanitizationFilter [\#299](https://github.com/gjtorikian/html-pipeline/pull/299) ([stanhu](https://github.com/stanhu)) ## [v2.8.3](https://github.com/gjtorikian/html-pipeline/tree/v2.8.3) (2018-06-29) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.8.2...v2.8.3) **Closed issues:** - Accessibility-related HTML isn't whitelisted [\#215](https://github.com/gjtorikian/html-pipeline/issues/215) **Merged pull requests:** - Whitelist some accessibility properties [\#298](https://github.com/gjtorikian/html-pipeline/pull/298) ([gjtorikian](https://github.com/gjtorikian)) ## [v2.8.2](https://github.com/gjtorikian/html-pipeline/tree/v2.8.2) (2018-06-27) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.8.1...v2.8.2) ## [v2.8.1](https://github.com/gjtorikian/html-pipeline/tree/v2.8.1) (2018-06-26) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.8.0...v2.8.1) **Merged pull requests:** - \[PATCH\] Fix XSS vulnerability on table of content generation [\#296](https://github.com/gjtorikian/html-pipeline/pull/296) ([gjtorikian](https://github.com/gjtorikian)) ## [v2.8.0](https://github.com/gjtorikian/html-pipeline/tree/v2.8.0) (2018-05-04) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.7.2...v2.8.0) **Merged pull requests:** - Ensure \ nodes are not removed after syntax highlighting [\#295](https://github.com/gjtorikian/html-pipeline/pull/295) ([ianks](https://github.com/ianks)) ## [v2.7.2](https://github.com/gjtorikian/html-pipeline/tree/v2.7.2) (2018-04-25) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.7.1...v2.7.2) **Closed issues:** - emoji autocomplet/suggestion [\#294](https://github.com/gjtorikian/html-pipeline/issues/294) - Bug in allowed attributes [\#287](https://github.com/gjtorikian/html-pipeline/issues/287) - Github Flavoured Markdown table support [\#269](https://github.com/gjtorikian/html-pipeline/issues/269) - Allow embedding of JSON-LD [\#250](https://github.com/gjtorikian/html-pipeline/issues/250) **Merged pull requests:** - Update README.md \[ci skip\] [\#293](https://github.com/gjtorikian/html-pipeline/pull/293) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Disable processing @mentions in \ tag [\#292](https://github.com/gjtorikian/html-pipeline/pull/292) ([ashmaroli](https://github.com/ashmaroli)) - Update dependencies [\#291](https://github.com/gjtorikian/html-pipeline/pull/291) ([gjtorikian](https://github.com/gjtorikian)) - Apply mention filter & emoji filter on node text [\#290](https://github.com/gjtorikian/html-pipeline/pull/290) ([ashmaroli](https://github.com/ashmaroli)) ## [v2.7.1](https://github.com/gjtorikian/html-pipeline/tree/v2.7.1) (2017-09-21) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.7.0...v2.7.1) **Closed issues:** - Eating LoadErrors can mask different problems [\#282](https://github.com/gjtorikian/html-pipeline/issues/282) **Merged pull requests:** - Reduce travis errors and move to trusty [\#285](https://github.com/gjtorikian/html-pipeline/pull/285) ([timdiggins](https://github.com/timdiggins)) - Output underlying load error when wrapping [\#284](https://github.com/gjtorikian/html-pipeline/pull/284) ([timdiggins](https://github.com/timdiggins)) - correct spelling mistake [\#281](https://github.com/gjtorikian/html-pipeline/pull/281) ([EdwardBetts](https://github.com/EdwardBetts)) ## [v2.7.0](https://github.com/gjtorikian/html-pipeline/tree/v2.7.0) (2017-08-16) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.6.0...v2.7.0) **Closed issues:** - github-markdown is abandonware. Lose it or resurrect+support it? [\#246](https://github.com/gjtorikian/html-pipeline/issues/246) **Merged pull requests:** - Fix CI~ [\#280](https://github.com/gjtorikian/html-pipeline/pull/280) ([kivikakk](https://github.com/kivikakk)) - Let users set the common marker extensions [\#279](https://github.com/gjtorikian/html-pipeline/pull/279) ([gwincr11](https://github.com/gwincr11)) - Update CHANGELOG for 2.6.0 [\#277](https://github.com/gjtorikian/html-pipeline/pull/277) ([carpodaster](https://github.com/carpodaster)) - Fix hyperlink in README [\#276](https://github.com/gjtorikian/html-pipeline/pull/276) ([jwilk](https://github.com/jwilk)) ## [v2.6.0](https://github.com/gjtorikian/html-pipeline/tree/v2.6.0) (2017-05-23) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.5.0...v2.6.0) **Merged pull requests:** - Set instrumentation name [\#275](https://github.com/gjtorikian/html-pipeline/pull/275) ([gjtorikian](https://github.com/gjtorikian)) - Switch to CommonMark [\#274](https://github.com/gjtorikian/html-pipeline/pull/274) ([kivikakk](https://github.com/kivikakk)) - add korgi to 3rd party extensions \[ci skip\] [\#271](https://github.com/gjtorikian/html-pipeline/pull/271) ([jodeci](https://github.com/jodeci)) ## [v2.5.0](https://github.com/gjtorikian/html-pipeline/tree/v2.5.0) (2017-01-13) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.4.2...v2.5.0) **Closed issues:** - Add `` to whitelist [\#265](https://github.com/gjtorikian/html-pipeline/issues/265) - Missing context keys for HTML::Pipeline::EmojiFilter: :asset\_root [\#262](https://github.com/gjtorikian/html-pipeline/issues/262) - Emoji \ tags does not pass W3C validationg [\#234](https://github.com/gjtorikian/html-pipeline/issues/234) - Incompatible character encodings: ASCII-8BIT and UTF-8 in EmailReplyFilter [\#229](https://github.com/gjtorikian/html-pipeline/issues/229) **Merged pull requests:** - Ruby 2.4 [\#268](https://github.com/gjtorikian/html-pipeline/pull/268) ([haileys](https://github.com/haileys)) ## [v2.4.2](https://github.com/gjtorikian/html-pipeline/tree/v2.4.2) (2016-07-11) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.4.1...v2.4.2) **Closed issues:** - Rails 5 support [\#252](https://github.com/gjtorikian/html-pipeline/issues/252) **Merged pull requests:** - Release v2.4.2 [\#260](https://github.com/gjtorikian/html-pipeline/pull/260) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Bump Active Support dependency to version \>= 2 [\#257](https://github.com/gjtorikian/html-pipeline/pull/257) ([JuanitoFatas](https://github.com/JuanitoFatas)) ## [v2.4.1](https://github.com/gjtorikian/html-pipeline/tree/v2.4.1) (2016-05-11) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.4.0...v2.4.1) **Merged pull requests:** - Bump gem to 2.4.1 [\#255](https://github.com/gjtorikian/html-pipeline/pull/255) ([jch](https://github.com/jch)) - Regression in EmailReplyPipeline: unfiltered content is being ommitted [\#253](https://github.com/gjtorikian/html-pipeline/pull/253) ([oreoshake](https://github.com/oreoshake)) ## [v2.4.0](https://github.com/gjtorikian/html-pipeline/tree/v2.4.0) (2016-04-11) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.3.0...v2.4.0) **Merged pull requests:** - Release 2.4.0 [\#248](https://github.com/gjtorikian/html-pipeline/pull/248) ([jch](https://github.com/jch)) - Optionally filter email addresses [\#247](https://github.com/gjtorikian/html-pipeline/pull/247) ([oreoshake](https://github.com/oreoshake)) ## [v2.3.0](https://github.com/gjtorikian/html-pipeline/tree/v2.3.0) (2016-01-20) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.2.4...v2.3.0) **Merged pull requests:** - Release 2.3.0 [\#245](https://github.com/gjtorikian/html-pipeline/pull/245) ([jch](https://github.com/jch)) - Creating the option to pass in an anchor icon, instead of using octicons [\#244](https://github.com/gjtorikian/html-pipeline/pull/244) ([jonrohan](https://github.com/jonrohan)) ## [v2.2.4](https://github.com/gjtorikian/html-pipeline/tree/v2.2.4) (2016-01-17) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.2.3...v2.2.4) **Merged pull requests:** - Use entire namespace so exception constant is resolved [\#243](https://github.com/gjtorikian/html-pipeline/pull/243) ([simeonwillbanks](https://github.com/simeonwillbanks)) ## [v2.2.3](https://github.com/gjtorikian/html-pipeline/tree/v2.2.3) (2016-01-14) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.2.2...v2.2.3) **Closed issues:** - `rescue LoadError; abort` flow for missing dependencies breaks client applications [\#240](https://github.com/gjtorikian/html-pipeline/issues/240) **Merged pull requests:** - Release 2.2.3 [\#242](https://github.com/gjtorikian/html-pipeline/pull/242) ([jch](https://github.com/jch)) - raise MissingDependencyError instead of aborting on missing dependency [\#241](https://github.com/gjtorikian/html-pipeline/pull/241) ([parkr](https://github.com/parkr)) - Fix typo [\#239](https://github.com/gjtorikian/html-pipeline/pull/239) ([rimenes](https://github.com/rimenes)) - Test against Ruby 2.3.0 on Travis CI [\#238](https://github.com/gjtorikian/html-pipeline/pull/238) ([tricknotes](https://github.com/tricknotes)) - use travis containers [\#237](https://github.com/gjtorikian/html-pipeline/pull/237) ([kbrock](https://github.com/kbrock)) ## [v2.2.2](https://github.com/gjtorikian/html-pipeline/tree/v2.2.2) (2015-10-27) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.2.1...v2.2.2) **Closed issues:** - 2.2.1 release [\#225](https://github.com/gjtorikian/html-pipeline/issues/225) **Merged pull requests:** - Release 2.2.2 [\#231](https://github.com/gjtorikian/html-pipeline/pull/231) ([jch](https://github.com/jch)) - Fix for calling mention\_link\_filter with only one argument [\#230](https://github.com/gjtorikian/html-pipeline/pull/230) ([benbalter](https://github.com/benbalter)) - Add html-pipeline-linkify\_github to 3rd Party Extensions \[ci skip\] [\#228](https://github.com/gjtorikian/html-pipeline/pull/228) ([JuanitoFatas](https://github.com/JuanitoFatas)) ## [v2.2.1](https://github.com/gjtorikian/html-pipeline/tree/v2.2.1) (2015-10-01) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.2.0...v2.2.1) **Merged pull requests:** - Soften Nokogiri dependency to versions "\>= 1.4" [\#208](https://github.com/gjtorikian/html-pipeline/pull/208) ([JuanitoFatas](https://github.com/JuanitoFatas)) ## [v2.2.0](https://github.com/gjtorikian/html-pipeline/tree/v2.2.0) (2015-09-28) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.1.0...v2.2.0) **Merged pull requests:** - Release 2.2.0 [\#224](https://github.com/gjtorikian/html-pipeline/pull/224) ([jch](https://github.com/jch)) - Only allow cite attribute on blockquote and restrict schemes [\#223](https://github.com/gjtorikian/html-pipeline/pull/223) ([btoews](https://github.com/btoews)) ## [v2.1.0](https://github.com/gjtorikian/html-pipeline/tree/v2.1.0) (2015-09-22) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v2.0...v2.1.0) **Closed issues:** - Add SmartQuotes filter [\#220](https://github.com/gjtorikian/html-pipeline/issues/220) - Need help fixing a non-security issue… [\#214](https://github.com/gjtorikian/html-pipeline/issues/214) - List GitHub-deployed versions somewhere? [\#201](https://github.com/gjtorikian/html-pipeline/issues/201) - Support limited use of the HTML 'style' attribute [\#192](https://github.com/gjtorikian/html-pipeline/issues/192) - Separate gems for versioning external dependencies [\#182](https://github.com/gjtorikian/html-pipeline/issues/182) **Merged pull requests:** - Release 2.1.0 [\#222](https://github.com/gjtorikian/html-pipeline/pull/222) ([jch](https://github.com/jch)) - Whitelist schemes for longdesc [\#221](https://github.com/gjtorikian/html-pipeline/pull/221) ([btoews](https://github.com/btoews)) - Update README.md [\#211](https://github.com/gjtorikian/html-pipeline/pull/211) ([st0012](https://github.com/st0012)) - Add ImageFilter for image url to img tag conversion [\#207](https://github.com/gjtorikian/html-pipeline/pull/207) ([st0012](https://github.com/st0012)) - Extract emoji image tag generation to own method [\#195](https://github.com/gjtorikian/html-pipeline/pull/195) ([kbrock](https://github.com/kbrock)) ## [v2.0](https://github.com/gjtorikian/html-pipeline/tree/v2.0) (2015-07-20) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.11.0...v2.0) **Closed issues:** - Feature request: Strikethrough if issue is closed [\#202](https://github.com/gjtorikian/html-pipeline/issues/202) - how can i read this code? [\#198](https://github.com/gjtorikian/html-pipeline/issues/198) - how can i read this code? [\#197](https://github.com/gjtorikian/html-pipeline/issues/197) - Change github-markdown dependency to a free licensed parser [\#196](https://github.com/gjtorikian/html-pipeline/issues/196) - possible bug? [\#193](https://github.com/gjtorikian/html-pipeline/issues/193) - Support ftp scheme for markdown URLs [\#187](https://github.com/gjtorikian/html-pipeline/issues/187) - Syntax highlighting example in Readme not working [\#186](https://github.com/gjtorikian/html-pipeline/issues/186) - OSX HTML::Pipeline::MarkdownFilter Fails on Right Double Quotation Mark around email address [\#173](https://github.com/gjtorikian/html-pipeline/issues/173) - Question - Can this work with Rouge? [\#166](https://github.com/gjtorikian/html-pipeline/issues/166) - Question about github markdown filter \(low priority!\) [\#165](https://github.com/gjtorikian/html-pipeline/issues/165) - Do not mention or emojify in a codeblock [\#163](https://github.com/gjtorikian/html-pipeline/issues/163) - MentionFilter base\_url config question [\#161](https://github.com/gjtorikian/html-pipeline/issues/161) - Feature Request: Add "details" tag to whitelist [\#138](https://github.com/gjtorikian/html-pipeline/issues/138) **Merged pull requests:** - Add three 3rd party filters. \[ci skip\] [\#185](https://github.com/gjtorikian/html-pipeline/pull/185) ([JuanitoFatas](https://github.com/JuanitoFatas)) - \[MentionFilter\] Dup string before modifying [\#181](https://github.com/gjtorikian/html-pipeline/pull/181) ([jch](https://github.com/jch)) - Constrain active support \>= 2, \< 5 [\#180](https://github.com/gjtorikian/html-pipeline/pull/180) ([jch](https://github.com/jch)) - Release 2.0 [\#179](https://github.com/gjtorikian/html-pipeline/pull/179) ([jch](https://github.com/jch)) - \[ci skip\] Fix CHANGELOG.md rendering. [\#177](https://github.com/gjtorikian/html-pipeline/pull/177) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Restrict nokogiri to specific versions [\#176](https://github.com/gjtorikian/html-pipeline/pull/176) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Use svg build badge. \[ci skip\] [\#175](https://github.com/gjtorikian/html-pipeline/pull/175) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Add 3rd party gem: html-pipeline-rouge\_filter. [\#174](https://github.com/gjtorikian/html-pipeline/pull/174) ([JuanitoFatas](https://github.com/JuanitoFatas)) - MentionFilter\#link\_to\_mentioned\_user: Replace String introspection with Regexp match [\#172](https://github.com/gjtorikian/html-pipeline/pull/172) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Whitelist summary and details element. [\#171](https://github.com/gjtorikian/html-pipeline/pull/171) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Implement new context option: ignored\_ancestor\_tags to accept more ignored tags. [\#170](https://github.com/gjtorikian/html-pipeline/pull/170) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Support ~login for MentionFilter. [\#167](https://github.com/gjtorikian/html-pipeline/pull/167) ([JuanitoFatas](https://github.com/JuanitoFatas)) - Add GitHub flavor Markdown Task List extension [\#162](https://github.com/gjtorikian/html-pipeline/pull/162) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Drop support for gemoji ~\> 1.0 [\#159](https://github.com/gjtorikian/html-pipeline/pull/159) ([jch](https://github.com/jch)) - Revert "Search for text nodes on DocumentFragments without root tags" [\#158](https://github.com/gjtorikian/html-pipeline/pull/158) ([jch](https://github.com/jch)) - @mention allow for custom regex to identify usernames. [\#157](https://github.com/gjtorikian/html-pipeline/pull/157) ([brittballard](https://github.com/brittballard)) - Drop support for ruby ree, 1.9.2 [\#156](https://github.com/gjtorikian/html-pipeline/pull/156) ([jch](https://github.com/jch)) - Use Linguist lexers [\#153](https://github.com/gjtorikian/html-pipeline/pull/153) ([pchaigno](https://github.com/pchaigno)) - Readme tweaks: add FAQ section, refresh 3rd party extensions [\#150](https://github.com/gjtorikian/html-pipeline/pull/150) ([jch](https://github.com/jch)) - \ tags are not skipped by EmojiFilter [\#147](https://github.com/gjtorikian/html-pipeline/pull/147) ([moskvax](https://github.com/moskvax)) ## [v1.11.0](https://github.com/gjtorikian/html-pipeline/tree/v1.11.0) (2014-09-15) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.10.0...v1.11.0) **Closed issues:** - @mention\_filter should not replace mentions in style blocks. [\#143](https://github.com/gjtorikian/html-pipeline/issues/143) - EmojiFilter doesn't work on strings that don't contain HTML [\#133](https://github.com/gjtorikian/html-pipeline/issues/133) **Merged pull requests:** - Search for text nodes on DocumentFragments without root tags [\#146](https://github.com/gjtorikian/html-pipeline/pull/146) ([Razer6](https://github.com/Razer6)) - Don't filter @mentions in \ tags [\#145](https://github.com/gjtorikian/html-pipeline/pull/145) ([jch](https://github.com/jch)) - Prefer http\_url in HttpsFilter [\#142](https://github.com/gjtorikian/html-pipeline/pull/142) ([bkeepers](https://github.com/bkeepers)) - Don't check twice if there is a ':' in content \(EmojiFilter\) [\#141](https://github.com/gjtorikian/html-pipeline/pull/141) ([Razer6](https://github.com/Razer6)) ## [v1.10.0](https://github.com/gjtorikian/html-pipeline/tree/v1.10.0) (2014-09-05) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.9.0...v1.10.0) **Closed issues:** - header tags are html-rendered with name="" instead of id="" [\#135](https://github.com/gjtorikian/html-pipeline/issues/135) - Enable syntax highlighting for inline code [\#134](https://github.com/gjtorikian/html-pipeline/issues/134) **Merged pull requests:** - Use id instead of name for TableOfContentsFilter [\#140](https://github.com/gjtorikian/html-pipeline/pull/140) ([bkeepers](https://github.com/bkeepers)) - adding "details" to tag whitelist [\#139](https://github.com/gjtorikian/html-pipeline/pull/139) ([tansaku](https://github.com/tansaku)) - Fix spelling in readme [\#137](https://github.com/gjtorikian/html-pipeline/pull/137) ([Razer6](https://github.com/Razer6)) - Remove ActiveSupport try\(\) dependency [\#132](https://github.com/gjtorikian/html-pipeline/pull/132) ([simeonwillbanks](https://github.com/simeonwillbanks)) ## [v1.9.0](https://github.com/gjtorikian/html-pipeline/tree/v1.9.0) (2014-07-07) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.8.0...v1.9.0) **Closed issues:** - Medico [\#128](https://github.com/gjtorikian/html-pipeline/issues/128) - Support ActiveSupport 4.1 [\#125](https://github.com/gjtorikian/html-pipeline/issues/125) - De-github https filter [\#123](https://github.com/gjtorikian/html-pipeline/issues/123) **Merged pull requests:** - Generalize https filter take 2 [\#131](https://github.com/gjtorikian/html-pipeline/pull/131) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Remove RUBY\_VERSION conditionals from gemspec [\#130](https://github.com/gjtorikian/html-pipeline/pull/130) ([mislav](https://github.com/mislav)) - Add compatibility with gemoji v2 [\#129](https://github.com/gjtorikian/html-pipeline/pull/129) ([mislav](https://github.com/mislav)) ## [v1.8.0](https://github.com/gjtorikian/html-pipeline/tree/v1.8.0) (2014-04-04) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.7.0...v1.8.0) **Implemented enhancements:** - Getting Started Guide [\#112](https://github.com/gjtorikian/html-pipeline/issues/112) **Merged pull requests:** - Adding support to supply the path to the emoji sprite in the emoji pipeline [\#122](https://github.com/gjtorikian/html-pipeline/pull/122) ([bradly](https://github.com/bradly)) - Initial Better README [\#118](https://github.com/gjtorikian/html-pipeline/pull/118) ([simeonwillbanks](https://github.com/simeonwillbanks)) ## [v1.7.0](https://github.com/gjtorikian/html-pipeline/tree/v1.7.0) (2014-03-11) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.6.0...v1.7.0) **Implemented enhancements:** - Contributing Guidelines [\#113](https://github.com/gjtorikian/html-pipeline/issues/113) **Closed issues:** - cut a 1.6.0 release [\#116](https://github.com/gjtorikian/html-pipeline/issues/116) - AutolinkFilter link\_attr doesn't seem to work [\#114](https://github.com/gjtorikian/html-pipeline/issues/114) - Spaces inserted into code [\#109](https://github.com/gjtorikian/html-pipeline/issues/109) **Merged pull requests:** - Allow \ and \ [\#120](https://github.com/gjtorikian/html-pipeline/pull/120) ([haileys](https://github.com/haileys)) - Ruby 2.1.1 [\#119](https://github.com/gjtorikian/html-pipeline/pull/119) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Notes on how to release a new gem version [\#117](https://github.com/gjtorikian/html-pipeline/pull/117) ([jch](https://github.com/jch)) - Initial Contributing Guidelines [\#115](https://github.com/gjtorikian/html-pipeline/pull/115) ([simeonwillbanks](https://github.com/simeonwillbanks)) ## [v1.6.0](https://github.com/gjtorikian/html-pipeline/tree/v1.6.0) (2014-02-14) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.5.0...v1.6.0) **Closed issues:** - EmailReplyParser is undefined [\#107](https://github.com/gjtorikian/html-pipeline/issues/107) - No stylesheets for SyntaxHighlightFilter [\#106](https://github.com/gjtorikian/html-pipeline/issues/106) - Camo Filter doesn't return doc when disabled [\#102](https://github.com/gjtorikian/html-pipeline/issues/102) - Passed content must be valid XML to be filtered [\#100](https://github.com/gjtorikian/html-pipeline/issues/100) - Emoji syntax gravatars [\#56](https://github.com/gjtorikian/html-pipeline/issues/56) **Merged pull requests:** - EmailReplyFilter depends on EmailReplyParser [\#110](https://github.com/gjtorikian/html-pipeline/pull/110) ([foca](https://github.com/foca)) - Document generating CSS for HTML formatted code [\#108](https://github.com/gjtorikian/html-pipeline/pull/108) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Stop using deprecated OpenSSL::Digest::Digest [\#103](https://github.com/gjtorikian/html-pipeline/pull/103) ([chrishunt](https://github.com/chrishunt)) ## [v1.5.0](https://github.com/gjtorikian/html-pipeline/tree/v1.5.0) (2014-01-22) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.4.0...v1.5.0) **Merged pull requests:** - Allow customization of allowed \ URL schemes [\#98](https://github.com/gjtorikian/html-pipeline/pull/98) ([aroben](https://github.com/aroben)) ## [v1.4.0](https://github.com/gjtorikian/html-pipeline/tree/v1.4.0) (2014-01-21) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.3.0...v1.4.0) **Merged pull requests:** - Don't URI parse src before passing to camo [\#101](https://github.com/gjtorikian/html-pipeline/pull/101) ([josh](https://github.com/josh)) ## [v1.3.0](https://github.com/gjtorikian/html-pipeline/tree/v1.3.0) (2014-01-14) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.2.0...v1.3.0) **Merged pull requests:** - Remove 1.8 from Travis build [\#99](https://github.com/gjtorikian/html-pipeline/pull/99) ([josh](https://github.com/josh)) ## [v1.2.0](https://github.com/gjtorikian/html-pipeline/tree/v1.2.0) (2014-01-09) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.1.0...v1.2.0) **Closed issues:** - Allow SSH protocol links [\#95](https://github.com/gjtorikian/html-pipeline/issues/95) - Straight quote → unicode curly quotes filter [\#94](https://github.com/gjtorikian/html-pipeline/issues/94) **Merged pull requests:** - Bump version 1.2.0 [\#97](https://github.com/gjtorikian/html-pipeline/pull/97) ([jch](https://github.com/jch)) - Camo Everything [\#96](https://github.com/gjtorikian/html-pipeline/pull/96) ([josh](https://github.com/josh)) ## [v1.1.0](https://github.com/gjtorikian/html-pipeline/tree/v1.1.0) (2013-11-20) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v1.0.0...v1.1.0) **Merged pull requests:** - Bump version 1.1.0 [\#93](https://github.com/gjtorikian/html-pipeline/pull/93) ([jch](https://github.com/jch)) - CGI.escape emoji name [\#92](https://github.com/gjtorikian/html-pipeline/pull/92) ([jayroh](https://github.com/jayroh)) ## [v1.0.0](https://github.com/gjtorikian/html-pipeline/tree/v1.0.0) (2013-10-29) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.3.1...v1.0.0) **Closed issues:** - Tagged releases for 0.3.0 and 0.3.1 [\#91](https://github.com/gjtorikian/html-pipeline/issues/91) - Potential class loading conflict with add-on filters [\#88](https://github.com/gjtorikian/html-pipeline/issues/88) - Place Dependency Management On Filters [\#77](https://github.com/gjtorikian/html-pipeline/issues/77) - Decrease number of dependencies [\#48](https://github.com/gjtorikian/html-pipeline/issues/48) **Merged pull requests:** - Add link\_attr option to Autolink filter [\#89](https://github.com/gjtorikian/html-pipeline/pull/89) ([excid3](https://github.com/excid3)) - Update readme with link to asciidoc filter [\#87](https://github.com/gjtorikian/html-pipeline/pull/87) ([jch](https://github.com/jch)) - use xml\_mini extracted from activesupport [\#85](https://github.com/gjtorikian/html-pipeline/pull/85) ([mojavelinux](https://github.com/mojavelinux)) - Filters Manage Dependencies [\#80](https://github.com/gjtorikian/html-pipeline/pull/80) ([simeonwillbanks](https://github.com/simeonwillbanks)) ## [v0.3.1](https://github.com/gjtorikian/html-pipeline/tree/v0.3.1) (2013-09-16) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.3.0...v0.3.1) **Closed issues:** - Tweaks to the email reply filter [\#82](https://github.com/gjtorikian/html-pipeline/issues/82) **Merged pull requests:** - Guard against nil node replacement results [\#84](https://github.com/gjtorikian/html-pipeline/pull/84) ([jbarnette](https://github.com/jbarnette)) ## [v0.3.0](https://github.com/gjtorikian/html-pipeline/tree/v0.3.0) (2013-08-30) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.2.1...v0.3.0) **Closed issues:** - Support for ActiveSupport 4 [\#76](https://github.com/gjtorikian/html-pipeline/issues/76) **Merged pull requests:** - Teach SyntaxHighlightFilter about default highlights [\#81](https://github.com/gjtorikian/html-pipeline/pull/81) ([jbarnette](https://github.com/jbarnette)) ## [v0.2.1](https://github.com/gjtorikian/html-pipeline/tree/v0.2.1) (2013-08-20) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.2.0...v0.2.1) **Closed issues:** - Implement an AsciiDoc filter based on Asciidoctor [\#59](https://github.com/gjtorikian/html-pipeline/issues/59) **Merged pull requests:** - Move activesupport to a development dependency [\#79](https://github.com/gjtorikian/html-pipeline/pull/79) ([jch](https://github.com/jch)) ## [v0.2.0](https://github.com/gjtorikian/html-pipeline/tree/v0.2.0) (2013-07-31) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.1.0...v0.2.0) **Merged pull requests:** - Generate Table of Contents [\#75](https://github.com/gjtorikian/html-pipeline/pull/75) ([simeonwillbanks](https://github.com/simeonwillbanks)) - Fix wrong class name at README.md [\#74](https://github.com/gjtorikian/html-pipeline/pull/74) ([tricknotes](https://github.com/tricknotes)) ## [v0.1.0](https://github.com/gjtorikian/html-pipeline/tree/v0.1.0) (2013-07-16) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.14...v0.1.0) **Closed issues:** - Fix travis-ci build [\#63](https://github.com/gjtorikian/html-pipeline/issues/63) - Loosen Markdown Dependency. [\#62](https://github.com/gjtorikian/html-pipeline/issues/62) - TocFilter: non-English characters in headers don't get proper anchor names [\#58](https://github.com/gjtorikian/html-pipeline/issues/58) - Whitelist table sections \(thead, tbody, tfoot\) [\#54](https://github.com/gjtorikian/html-pipeline/issues/54) - Warn if "pipelines" are out of order. [\#47](https://github.com/gjtorikian/html-pipeline/issues/47) **Merged pull requests:** - TocFilter: keep using the old punctuation stripping on 1.8.7 [\#73](https://github.com/gjtorikian/html-pipeline/pull/73) ([jakedouglas](https://github.com/jakedouglas)) - Add ruby 2.0.0 to .travis.yml [\#72](https://github.com/gjtorikian/html-pipeline/pull/72) ([tricknotes](https://github.com/tricknotes)) - Fix ignored test [\#71](https://github.com/gjtorikian/html-pipeline/pull/71) ([tricknotes](https://github.com/tricknotes)) - Improve to describe gem 'github-linguist' [\#69](https://github.com/gjtorikian/html-pipeline/pull/69) ([tricknotes](https://github.com/tricknotes)) - Bump version to 0.1.0. Follow semver. [\#68](https://github.com/gjtorikian/html-pipeline/pull/68) ([jch](https://github.com/jch)) - Scope gem versions for Travis CI [\#67](https://github.com/gjtorikian/html-pipeline/pull/67) ([jch](https://github.com/jch)) - Allow passing skip\_tags in autolink filter context [\#65](https://github.com/gjtorikian/html-pipeline/pull/65) ([pengwynn](https://github.com/pengwynn)) - Support non-English characters in anchor names [\#64](https://github.com/gjtorikian/html-pipeline/pull/64) ([jakedouglas](https://github.com/jakedouglas)) - Fix the `AutolinkFilter` constant name. [\#57](https://github.com/gjtorikian/html-pipeline/pull/57) ([envygeeks](https://github.com/envygeeks)) - resolves \#54 allow table section elements \(thead, tfoot, tbody\) [\#55](https://github.com/gjtorikian/html-pipeline/pull/55) ([mojavelinux](https://github.com/mojavelinux)) ## [v0.0.14](https://github.com/gjtorikian/html-pipeline/tree/v0.0.14) (2013-05-22) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.13...v0.0.14) **Closed issues:** - Give rsanheim rights to pushing gems [\#53](https://github.com/gjtorikian/html-pipeline/issues/53) ## [v0.0.13](https://github.com/gjtorikian/html-pipeline/tree/v0.0.13) (2013-05-13) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.12...v0.0.13) **Closed issues:** - Can I use MentionFilter without MarkdownFilter [\#51](https://github.com/gjtorikian/html-pipeline/issues/51) **Merged pull requests:** - New octicon class names [\#52](https://github.com/gjtorikian/html-pipeline/pull/52) ([cameronmcefee](https://github.com/cameronmcefee)) - Strip contents of \ tags. [\#50](https://github.com/gjtorikian/html-pipeline/pull/50) ([benubois](https://github.com/benubois)) ## [v0.0.12](https://github.com/gjtorikian/html-pipeline/tree/v0.0.12) (2013-04-01) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.11...v0.0.12) **Merged pull requests:** - Include output and results to filter, pipeline event payload [\#46](https://github.com/gjtorikian/html-pipeline/pull/46) ([mtodd](https://github.com/mtodd)) ## [v0.0.11](https://github.com/gjtorikian/html-pipeline/tree/v0.0.11) (2013-03-29) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.10...v0.0.11) **Merged pull requests:** - Instrument filters in the pipeline [\#45](https://github.com/gjtorikian/html-pipeline/pull/45) ([mtodd](https://github.com/mtodd)) ## [v0.0.10](https://github.com/gjtorikian/html-pipeline/tree/v0.0.10) (2013-03-21) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.8.1...v0.0.10) **Closed issues:** - Executable for previewing [\#43](https://github.com/gjtorikian/html-pipeline/issues/43) **Merged pull requests:** - Add an html-pipeline executable to the gem [\#44](https://github.com/gjtorikian/html-pipeline/pull/44) ([indirect](https://github.com/indirect)) - add result\[:mentioned\_usernames\] for MentionFilter [\#42](https://github.com/gjtorikian/html-pipeline/pull/42) ([fahchen](https://github.com/fahchen)) ## [v0.0.8.1](https://github.com/gjtorikian/html-pipeline/tree/v0.0.8.1) (2013-03-03) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.9...v0.0.8.1) ## [v0.0.9](https://github.com/gjtorikian/html-pipeline/tree/v0.0.9) (2013-02-27) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.8...v0.0.9) **Closed issues:** - Better error notification on missing linguist dependency? [\#36](https://github.com/gjtorikian/html-pipeline/issues/36) **Merged pull requests:** - Bump escape\_utils [\#41](https://github.com/gjtorikian/html-pipeline/pull/41) ([brianmario](https://github.com/brianmario)) - Don't monkeypatch Nokogiri in 1.9 [\#40](https://github.com/gjtorikian/html-pipeline/pull/40) ([defunkt](https://github.com/defunkt)) ## [v0.0.8](https://github.com/gjtorikian/html-pipeline/tree/v0.0.8) (2013-02-07) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.7...v0.0.8) **Closed issues:** - Optionally require github-linguist [\#33](https://github.com/gjtorikian/html-pipeline/issues/33) **Merged pull requests:** - Raise the roof---I mean, error [\#37](https://github.com/gjtorikian/html-pipeline/pull/37) ([gjtorikian](https://github.com/gjtorikian)) ## [v0.0.7](https://github.com/gjtorikian/html-pipeline/tree/v0.0.7) (2013-01-30) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.6...v0.0.7) **Closed issues:** - Where to report custom filters? [\#30](https://github.com/gjtorikian/html-pipeline/issues/30) **Merged pull requests:** - Remove github-linguist dependency [\#35](https://github.com/gjtorikian/html-pipeline/pull/35) ([jch](https://github.com/jch)) - Delete erroneous trailing {}s from README [\#34](https://github.com/gjtorikian/html-pipeline/pull/34) ([mrb](https://github.com/mrb)) ## [v0.0.6](https://github.com/gjtorikian/html-pipeline/tree/v0.0.6) (2012-12-11) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.5...v0.0.6) **Merged pull requests:** - use \#gsub instead of \#gsub! in MarkdownFilter\#initialize [\#32](https://github.com/gjtorikian/html-pipeline/pull/32) ([jakedouglas](https://github.com/jakedouglas)) ## [v0.0.5](https://github.com/gjtorikian/html-pipeline/tree/v0.0.5) (2012-12-10) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.4...v0.0.5) **Merged pull requests:** - Fix XSS vulnerability in sanitization filter [\#31](https://github.com/gjtorikian/html-pipeline/pull/31) ([jch](https://github.com/jch)) - Fix typo on readme in "AutolinkFilter" doc [\#29](https://github.com/gjtorikian/html-pipeline/pull/29) ([dmarcotte](https://github.com/dmarcotte)) - fix syntax highlighting example in Readme [\#27](https://github.com/gjtorikian/html-pipeline/pull/27) ([mislav](https://github.com/mislav)) - remove github-linguist dependency [\#26](https://github.com/gjtorikian/html-pipeline/pull/26) ([mislav](https://github.com/mislav)) - Retrigger Travis build for debugging [\#25](https://github.com/gjtorikian/html-pipeline/pull/25) ([jch](https://github.com/jch)) - Use consistent quotes in gemspec [\#24](https://github.com/gjtorikian/html-pipeline/pull/24) ([jbarnette](https://github.com/jbarnette)) - Add MIT license indicator to the gemspec. [\#23](https://github.com/gjtorikian/html-pipeline/pull/23) ([nbibler](https://github.com/nbibler)) - Context validation [\#22](https://github.com/gjtorikian/html-pipeline/pull/22) ([benubois](https://github.com/benubois)) - Corrected a little typo [\#21](https://github.com/gjtorikian/html-pipeline/pull/21) ([blackerby](https://github.com/blackerby)) - Added an example of a custom filter. [\#19](https://github.com/gjtorikian/html-pipeline/pull/19) ([benubois](https://github.com/benubois)) - Use correct OSS Manifesto link. [\#18](https://github.com/gjtorikian/html-pipeline/pull/18) ([wickedshimmy](https://github.com/wickedshimmy)) - Fixed typos [\#17](https://github.com/gjtorikian/html-pipeline/pull/17) ([pborreli](https://github.com/pborreli)) - What is the github filter chain? [\#16](https://github.com/gjtorikian/html-pipeline/pull/16) ([geemus](https://github.com/geemus)) - Loosen Gemoji restriction [\#15](https://github.com/gjtorikian/html-pipeline/pull/15) ([josh](https://github.com/josh)) ## [v0.0.4](https://github.com/gjtorikian/html-pipeline/tree/v0.0.4) (2012-11-06) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/v0.0.3...v0.0.4) **Implemented enhancements:** - Detect asset pipeline availability [\#1](https://github.com/gjtorikian/html-pipeline/issues/1) **Fixed bugs:** - @mention at end of parenthetical sentence doesn't get linked [\#11](https://github.com/gjtorikian/html-pipeline/issues/11) **Closed issues:** - Open source, transferring repo ownership [\#12](https://github.com/gjtorikian/html-pipeline/issues/12) - Ensure we get the latest from github/github [\#10](https://github.com/gjtorikian/html-pipeline/issues/10) - Rename repository to html-pipeline [\#7](https://github.com/gjtorikian/html-pipeline/issues/7) **Merged pull requests:** - HTML::Pipeline::Pipeline [\#13](https://github.com/gjtorikian/html-pipeline/pull/13) ([jbarnette](https://github.com/jbarnette)) ## [v0.0.3](https://github.com/gjtorikian/html-pipeline/tree/v0.0.3) (2012-10-03) [Full Changelog](https://github.com/gjtorikian/html-pipeline/compare/a08f65df81dba0004c2de429848cd9a202917d04...v0.0.3) **Closed issues:** - History [\#3](https://github.com/gjtorikian/html-pipeline/issues/3) **Merged pull requests:** - Ensure required context values are present [\#9](https://github.com/gjtorikian/html-pipeline/pull/9) ([juliamae](https://github.com/juliamae)) - emoji filter requires the emoji gem [\#8](https://github.com/gjtorikian/html-pipeline/pull/8) ([atmos](https://github.com/atmos)) - De-Github and opensource [\#6](https://github.com/gjtorikian/html-pipeline/pull/6) ([jch](https://github.com/jch)) \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* html-pipeline-2.14.3/CONTRIBUTING.md000066400000000000000000000030051432233603200165750ustar00rootroot00000000000000# Contributing Thanks for using and improving `HTML::Pipeline`! - [Submitting a New Issue](#submitting-a-new-issue) - [Sending a Pull Request](#sending-a-pull-request) ## Submitting a New Issue If there's an idea you'd like to propose, or a design change, feel free to file a new issue. If you have an implementation question or believe you've found a bug, please provide as many details as possible: - Input document - Output HTML document - the exact `HTML::Pipeline` code you are using - output of the following from your project ``` ruby -v bundle exec nokogiri -v ``` ## Sending a Pull Request [Pull requests][pr] are always welcome! Check out [the project's issues list][issues] for ideas on what could be improved. Before sending, please add tests and ensure the test suite passes. ### Running the Tests To run the full suite: `bundle exec rake` To run a specific test file: `bundle exec ruby -Itest test/html/pipeline_test.rb` To run a specific test: `bundle exec ruby -Itest test/html/pipeline/markdown_filter_test.rb -n test_disabling_gfm` To run the full suite with all [supported rubies][travisyaml] in bash: ```bash rubies=(ree-1.8.7-2011.03 1.9.2-p290 1.9.3-p429 2.0.0-p247) for r in ${rubies[*]} do rbenv local $r # switch to your version manager of choice bundle install bundle exec rake done ``` [issues]: https://github.com/jch/html-pipeline/issues [pr]: https://help.github.com/articles/using-pull-requests [travisyaml]: https://github.com/jch/html-pipeline/blob/master/.travis.yml html-pipeline-2.14.3/Gemfile000066400000000000000000000012321432233603200156370ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in html-pipeline.gemspec gemspec group :development do gem 'appraisal' gem 'bundler' gem 'rake' end group :test do gem 'commonmarker', '~> 0.16', require: false gem 'email_reply_parser', '~> 0.5', require: false gem 'gemoji', '~> 2.0', require: false gem 'minitest' gem 'RedCloth', '~> 4.2.9', require: false gem 'rinku', '~> 1.7', require: false gem 'sanitize', '~> 4.6', require: false gem 'escape_utils', '~> 1.0', require: false gem 'rouge', '~> 3.1', require: false gem 'minitest-focus', '~> 1.1' end html-pipeline-2.14.3/LICENSE000066400000000000000000000020741432233603200153560ustar00rootroot00000000000000Copyright (c) 2012 GitHub Inc. and Jerry Cheung MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.html-pipeline-2.14.3/README.md000066400000000000000000000322641432233603200156340ustar00rootroot00000000000000# HTML::Pipeline [![Build Status](https://travis-ci.org/jch/html-pipeline.svg?branch=master)](https://travis-ci.org/jch/html-pipeline) HTML processing filters and utilities. This module includes a small framework for defining DOM based content filters and applying them to user provided content. [This project was started at GitHub](https://github.com/blog/1311-html-pipeline-chainable-content-filters). While GitHub still uses a similar design and pattern for rendering content, this gem should be considered standalone and independent from GitHub. - [Installation](#installation) - [Usage](#usage) - [Examples](#examples) - [Filters](#filters) - [Dependencies](#dependencies) - [Documentation](#documentation) - [Extending](#extending) - [3rd Party Extensions](#3rd-party-extensions) - [Instrumenting](#instrumenting) - [Contributing](#contributing) - [Contributors](#contributors) - [Releasing A New Version](#releasing-a-new-version) ## Installation Add this line to your application's Gemfile: ```ruby gem 'html-pipeline' ``` And then execute: ```sh $ bundle ``` Or install it by yourself as: ```sh $ gem install html-pipeline ``` ## Usage This library provides a handful of chainable HTML filters to transform user content into markup. A filter takes an HTML string or `Nokogiri::HTML::DocumentFragment`, optionally manipulates it, and then outputs the result. For example, to transform Markdown source into Markdown HTML: ```ruby require 'html/pipeline' filter = HTML::Pipeline::MarkdownFilter.new("Hi **world**!") filter.call ``` Filters can be combined into a pipeline which causes each filter to hand its output to the next filter's input. So if you wanted to have content be filtered through Markdown and be syntax highlighted, you can create the following pipeline: ```ruby pipeline = HTML::Pipeline.new [ HTML::Pipeline::MarkdownFilter, HTML::Pipeline::SyntaxHighlightFilter ] result = pipeline.call <<-CODE This is *great*: some_code(:first) CODE result[:output].to_s ``` Prints: ```html

This is great:

some_code(:first)
``` To generate CSS for HTML formatted code, use the [Rouge CSS Theme](https://github.com/rouge-ruby/rouge#css-options) `#css` method. `rouge` is a dependency of the `SyntaxHighlightFilter`. Some filters take an optional **context** and/or **result** hash. These are used to pass around arguments and metadata between filters in a pipeline. For example, if you don't want to use GitHub formatted Markdown, you can pass an option in the context hash: ```ruby filter = HTML::Pipeline::MarkdownFilter.new("Hi **world**!", :gfm => false) filter.call ``` ### Examples We define different pipelines for different parts of our app. Here are a few paraphrased snippets to get you started: ```ruby # The context hash is how you pass options between different filters. # See individual filter source for explanation of options. context = { :asset_root => "http://your-domain.com/where/your/images/live/icons", :base_url => "http://your-domain.com" } # Pipeline providing sanitization and image hijacking but no mention # related features. SimplePipeline = Pipeline.new [ SanitizationFilter, TableOfContentsFilter, # add 'name' anchors to all headers and generate toc list CamoFilter, ImageMaxWidthFilter, SyntaxHighlightFilter, EmojiFilter, AutolinkFilter ], context # Pipeline used for user provided content on the web MarkdownPipeline = Pipeline.new [ MarkdownFilter, SanitizationFilter, CamoFilter, ImageMaxWidthFilter, HttpsFilter, MentionFilter, EmojiFilter, SyntaxHighlightFilter ], context.merge(:gfm => true) # enable github formatted markdown # Define a pipeline based on another pipeline's filters NonGFMMarkdownPipeline = Pipeline.new(MarkdownPipeline.filters, context.merge(:gfm => false)) # Pipelines aren't limited to the web. You can use them for email # processing also. HtmlEmailPipeline = Pipeline.new [ PlainTextInputFilter, ImageMaxWidthFilter ], {} # Just emoji. EmojiPipeline = Pipeline.new [ PlainTextInputFilter, EmojiFilter ], context ``` ## Filters * `MentionFilter` - replace `@user` mentions with links * `TeamMentionFilter` - replace `@org/team` mentions with links * `AbsoluteSourceFilter` - replace relative image urls with fully qualified versions * `AutolinkFilter` - auto_linking urls in HTML * `CamoFilter` - replace http image urls with [camo-fied](https://github.com/atmos/camo) https versions * `EmailReplyFilter` - util filter for working with emails * `EmojiFilter` - everyone loves [emoji](http://www.emoji-cheat-sheet.com/)! * `HttpsFilter` - HTML Filter for replacing http github urls with https versions. * `ImageMaxWidthFilter` - link to full size image for large images * `MarkdownFilter` - convert markdown to html * `PlainTextInputFilter` - html escape text and wrap the result in a div * `SanitizationFilter` - allow sanitize user markup * `SyntaxHighlightFilter` - code syntax highlighter * `TextileFilter` - convert textile to html * `TableOfContentsFilter` - anchor headings with name attributes and generate Table of Contents html unordered list linking headings ## Dependencies Filter gem dependencies are not bundled; you must bundle the filter's gem dependencies. The below list details filters with dependencies. For example, `SyntaxHighlightFilter` uses [rouge](https://github.com/jneen/rouge) to detect and highlight languages. For example, to use the `SyntaxHighlightFilter`, add the following to your Gemfile: ```ruby gem 'rouge' ``` * `AutolinkFilter` - `rinku` * `EmailReplyFilter` - `escape_utils`, `email_reply_parser` * `EmojiFilter` - `gemoji` * `MarkdownFilter` - `commonmarker` * `PlainTextInputFilter` - `escape_utils` * `SanitizationFilter` - `sanitize` * `SyntaxHighlightFilter` - `rouge` * `TableOfContentsFilter` - `escape_utils` * `TextileFilter` - `RedCloth` _Note:_ See [Gemfile](/Gemfile) `:test` block for version requirements. ## Documentation Full reference documentation can be [found here](http://rubydoc.info/gems/html-pipeline/frames). ## Extending To write a custom filter, you need a class with a `call` method that inherits from `HTML::Pipeline::Filter`. For example this filter adds a base url to images that are root relative: ```ruby require 'uri' class RootRelativeFilter < HTML::Pipeline::Filter def call doc.search("img").each do |img| next if img['src'].nil? src = img['src'].strip if src.start_with? '/' img["src"] = URI.join(context[:base_url], src).to_s end end doc end end ``` Now this filter can be used in a pipeline: ```ruby Pipeline.new [ RootRelativeFilter ], { :base_url => 'http://somehost.com' } ``` ### 3rd Party Extensions If you have an idea for a filter, propose it as [an issue](https://github.com/jch/html-pipeline/issues) first. This allows us discuss whether the filter is a common enough use case to belong in this gem, or should be built as an external gem. Here are some extensions people have built: * [html-pipeline-asciidoc_filter](https://github.com/asciidoctor/html-pipeline-asciidoc_filter) * [jekyll-html-pipeline](https://github.com/gjtorikian/jekyll-html-pipeline) * [nanoc-html-pipeline](https://github.com/burnto/nanoc-html-pipeline) * [html-pipeline-bitly](https://github.com/dewski/html-pipeline-bitly) * [html-pipeline-cite](https://github.com/lifted-studios/html-pipeline-cite) * [tilt-html-pipeline](https://github.com/bradgessler/tilt-html-pipeline) * [html-pipeline-wiki-link'](https://github.com/lifted-studios/html-pipeline-wiki-link) - WikiMedia-style wiki links * [task_list](https://github.com/github/task_list) - GitHub flavor Markdown Task List * [html-pipeline-nico_link](https://github.com/rutan/html-pipeline-nico_link) - An HTML::Pipeline filter for [niconico](http://www.nicovideo.jp) description links * [html-pipeline-gitlab](https://gitlab.com/gitlab-org/html-pipeline-gitlab) - This gem implements various filters for html-pipeline used by GitLab * [html-pipeline-youtube](https://github.com/st0012/html-pipeline-youtube) - An HTML::Pipeline filter for YouTube links * [html-pipeline-flickr](https://github.com/st0012/html-pipeline-flickr) - An HTML::Pipeline filter for Flickr links * [html-pipeline-vimeo](https://github.com/dlackty/html-pipeline-vimeo) - An HTML::Pipeline filter for Vimeo links * [html-pipeline-hashtag](https://github.com/mr-dxdy/html-pipeline-hashtag) - An HTML::Pipeline filter for hashtags * [html-pipeline-linkify_github](https://github.com/jollygoodcode/html-pipeline-linkify_github) - An HTML::Pipeline filter to autolink GitHub urls * [html-pipeline-redcarpet_filter](https://github.com/bmikol/html-pipeline-redcarpet_filter) - Render Markdown source text into Markdown HTML using Redcarpet * [html-pipeline-typogruby_filter](https://github.com/bmikol/html-pipeline-typogruby_filter) - Add Typogruby text filters to your HTML::Pipeline * [korgi](https://github.com/jodeci/korgi) - HTML::Pipeline filters for links to Rails resources ## Instrumenting Filters and Pipelines can be set up to be instrumented when called. The pipeline must be setup with an [ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) compatible service object and a name. New pipeline objects will default to the `HTML::Pipeline.default_instrumentation_service` object. ``` ruby # the AS::Notifications-compatible service object service = ActiveSupport::Notifications # instrument a specific pipeline pipeline = HTML::Pipeline.new [MarkdownFilter], context pipeline.setup_instrumentation "MarkdownPipeline", service # or set default instrumentation service for all new pipelines HTML::Pipeline.default_instrumentation_service = service pipeline = HTML::Pipeline.new [MarkdownFilter], context pipeline.setup_instrumentation "MarkdownPipeline" ``` Filters are instrumented when they are run through the pipeline. A `call_filter.html_pipeline` event is published once the filter finishes. The `payload` should include the `filter` name. Each filter will trigger its own instrumentation call. ``` ruby service.subscribe "call_filter.html_pipeline" do |event, start, ending, transaction_id, payload| payload[:pipeline] #=> "MarkdownPipeline", set with `setup_instrumentation` payload[:filter] #=> "MarkdownFilter" payload[:context] #=> context Hash payload[:result] #=> instance of result class payload[:result][:output] #=> output HTML String or Nokogiri::DocumentFragment end ``` The full pipeline is also instrumented: ``` ruby service.subscribe "call_pipeline.html_pipeline" do |event, start, ending, transaction_id, payload| payload[:pipeline] #=> "MarkdownPipeline", set with `setup_instrumentation` payload[:filters] #=> ["MarkdownFilter"] payload[:doc] #=> HTML String or Nokogiri::DocumentFragment payload[:context] #=> context Hash payload[:result] #=> instance of result class payload[:result][:output] #=> output HTML String or Nokogiri::DocumentFragment end ``` ## FAQ ### 1. Why doesn't my pipeline work when there's no root element in the document? To make a pipeline work on a plain text document, put the `PlainTextInputFilter` at the beginning of your pipeline. This will wrap the content in a `div` so the filters have a root element to work with. If you're passing in an HTML fragment, but it doesn't have a root element, you can wrap the content in a `div` yourself. For example: ```ruby EmojiPipeline = Pipeline.new [ PlainTextInputFilter, # <- Wraps input in a div and escapes html tags EmojiFilter ], context plain_text = "Gutentag! :wave:" EmojiPipeline.call(plain_text) html_fragment = "This is outside of an html element, but this isn't. :+1:" EmojiPipeline.call("
#{html_fragment}
") # <- Wrap your own html fragments to avoid escaping ``` ### 2. How do I customize an allowlist for `SanitizationFilter`s? `SanitizationFilter::ALLOWLIST` is the default allowlist used if no `:allowlist` argument is given in the context. The default is a good starting template for you to add additional elements. You can either modify the constant's value, or re-define your own constant and pass that in via the context. ## Contributing Please review the [Contributing Guide](https://github.com/jch/html-pipeline/blob/master/CONTRIBUTING.md). 1. [Fork it](https://help.github.com/articles/fork-a-repo) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Added some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new [Pull Request](https://help.github.com/articles/using-pull-requests) To see what has changed in recent versions, see the [CHANGELOG](https://github.com/jch/html-pipeline/blob/master/CHANGELOG.md). ### Contributors Thanks to all of [these contributors](https://github.com/jch/html-pipeline/graphs/contributors). Project is a member of the [OSS Manifesto](http://ossmanifesto.org/). The current maintainer is @gjtorikian ### Releasing A New Version This section is for gem maintainers to cut a new version of the gem. * create a new branch named `release-x.y.z` where `x.y.z` follows [semver](http://semver.org) * update lib/html/pipeline/version.rb to next version number X.X.X * update CHANGELOG.md. Prepare a draft with `script/changelog` * push branch and create a new pull request * after tests are green, merge to master * on the master branch, run `script/release` html-pipeline-2.14.3/Rakefile000077500000000000000000000004601432233603200160160ustar00rootroot00000000000000#!/usr/bin/env rake # frozen_string_literal: true require 'rubygems' require 'bundler/setup' require 'bundler/gem_tasks' require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'test' t.test_files = FileList['test/**/*_test.rb'] t.verbose = true t.warning = false end task default: :test html-pipeline-2.14.3/bin/000077500000000000000000000000001432233603200151165ustar00rootroot00000000000000html-pipeline-2.14.3/bin/html-pipeline000077500000000000000000000033221432233603200176130ustar00rootroot00000000000000#!/usr/bin/env ruby require 'html/pipeline' require 'optparse' # Accept "help", too .map! { |a| a == 'help' ? '--help' : a } onParser.new do |opts| opts.banner = <<-HELP.gsub(/^ /, '') Usage: html-pipeline [-h] [-f] html-pipeline [FILTER [FILTER [...]]] < file.md cat file.md | html-pipeline [FILTER [FILTER [...]]] HELP opts.separator 'Options:' opts.on('-f', '--filters', 'List the available filters') do filters = HTML::Pipeline.constants.grep(/\w+Filter$/) .map { |f| f.to_s.gsub(/Filter$/, '') } # Text filter doesn't work, no call method filters -= ['Text'] abort <<-HELP.gsub(/^ /, '') Available filters: #{filters.join("\n ")} HELP end end.parse! # Default to a GitHub-ish pipeline if ARGV.empty? filters = [ HTML::Pipeline::MarkdownFilter, HTML::Pipeline::SanitizationFilter, HTML::Pipeline::ImageMaxWidthFilter, HTML::Pipeline::EmojiFilter, HTML::Pipeline::AutolinkFilter, HTML::Pipeline::TableOfContentsFilter ] # Add syntax highlighting if rouge is present begin require 'rouge' filters << HTML::Pipeline::SyntaxHighlightFilter rescue LoadError end else def filter_named(name) case name when 'Text' raise NameError # Text filter doesn't work, no call method end HTML::Pipeline.const_get("#{name}Filter") rescue NameError => e abort "Unknown filter '#{name}'. List filters with the -f option." end filters = [] until ARGV.empty? name = ARGV.shift filters << filter_named(name) end end context = { asset_root: '/assets', base_url: '/', gfm: true } puts HTML::Pipeline.new(filters, context).call(ARGF.read)[:output] html-pipeline-2.14.3/gemfiles/000077500000000000000000000000001432233603200161415ustar00rootroot00000000000000html-pipeline-2.14.3/gemfiles/rails_3.gemfile000066400000000000000000000011731432233603200210310ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rack", "< 2" gem "rails", "3.2.22.2" group :development do gem "appraisal" gem "bundler" gem "rake" end group :test do gem "commonmarker", "~> 0.16", require: false gem "email_reply_parser", "~> 0.5", require: false gem "gemoji", "~> 2.0", require: false gem "minitest" gem "RedCloth", "~> 4.2.9", require: false gem "rinku", "~> 1.7", require: false gem "sanitize", "~> 4.6", require: false gem "escape_utils", "~> 1.0", require: false gem "rouge", "~> 3.1", require: false gem "minitest-focus", "~> 1.1" end gemspec path: "../" html-pipeline-2.14.3/gemfiles/rails_4.gemfile000066400000000000000000000011731432233603200210320ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rack", "< 2" gem "rails", "~> 4.2.6" group :development do gem "appraisal" gem "bundler" gem "rake" end group :test do gem "commonmarker", "~> 0.16", require: false gem "email_reply_parser", "~> 0.5", require: false gem "gemoji", "~> 2.0", require: false gem "minitest" gem "RedCloth", "~> 4.2.9", require: false gem "rinku", "~> 1.7", require: false gem "sanitize", "~> 4.6", require: false gem "escape_utils", "~> 1.0", require: false gem "rouge", "~> 3.1", require: false gem "minitest-focus", "~> 1.1" end gemspec path: "../" html-pipeline-2.14.3/gemfiles/rails_5.gemfile000066400000000000000000000011511432233603200210270ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rails", "~> 5.0.0" group :development do gem "appraisal" gem "bundler" gem "rake" end group :test do gem "commonmarker", "~> 0.16", require: false gem "email_reply_parser", "~> 0.5", require: false gem "gemoji", "~> 2.0", require: false gem "minitest" gem "RedCloth", "~> 4.2.9", require: false gem "rinku", "~> 1.7", require: false gem "sanitize", "~> 4.6", require: false gem "escape_utils", "~> 1.0", require: false gem "rouge", "~> 3.1", require: false gem "minitest-focus", "~> 1.1" end gemspec path: "../" html-pipeline-2.14.3/gemfiles/rails_6.gemfile000066400000000000000000000011511432233603200210300ustar00rootroot00000000000000# This file was generated by Appraisal source "https://rubygems.org" gem "rails", "~> 6.0.0" group :development do gem "appraisal" gem "bundler" gem "rake" end group :test do gem "commonmarker", "~> 0.16", require: false gem "email_reply_parser", "~> 0.5", require: false gem "gemoji", "~> 2.0", require: false gem "minitest" gem "RedCloth", "~> 4.2.9", require: false gem "rinku", "~> 1.7", require: false gem "sanitize", "~> 4.6", require: false gem "escape_utils", "~> 1.0", require: false gem "rouge", "~> 3.1", require: false gem "minitest-focus", "~> 1.1" end gemspec path: "../" html-pipeline-2.14.3/html-pipeline.gemspec000066400000000000000000000022071432233603200204630ustar00rootroot00000000000000# frozen_string_literal: true require File.expand_path('../lib/html/pipeline/version', __FILE__) Gem::Specification.new do |gem| gem.name = 'html-pipeline' gem.version = HTML::Pipeline::VERSION gem.license = 'MIT' gem.authors = ['Ryan Tomayko', 'Jerry Cheung', 'Garen J. Torikian'] gem.email = ['ryan@github.com', 'jerry@github.com', 'gjtorikian@gmail.com'] gem.description = 'GitHub HTML processing filters and utilities' gem.summary = 'Helpers for processing content through a chain of filters' gem.homepage = 'https://github.com/jch/html-pipeline' gem.files = `git ls-files -z`.split("\x0").reject { |f| f =~ %r{^(test|gemfiles|script)/} } gem.require_paths = ['lib'] gem.add_dependency 'activesupport', '>= 2' gem.add_dependency 'nokogiri', '>= 1.4' gem.post_install_message = < e raise MissingDependencyError, "Missing dependency '#{name}' for #{requirer}. See README.md for details.\n#{e.class.name}: #{e}" end # Our DOM implementation. DocumentFragment = Nokogiri::HTML::DocumentFragment # Parse a String into a DocumentFragment object. When a DocumentFragment is # provided, return it verbatim. def self.parse(document_or_html) document_or_html ||= '' if document_or_html.is_a?(String) DocumentFragment.parse(document_or_html) else document_or_html end end # Public: Returns an Array of Filter objects for this Pipeline. attr_reader :filters # Public: Instrumentation service for the pipeline. # Set an ActiveSupport::Notifications compatible object to enable. attr_accessor :instrumentation_service # Public: String name for this Pipeline. Defaults to Class name. attr_writer :instrumentation_name def instrumentation_name return @instrumentation_name if defined?(@instrumentation_name) @instrumentation_name = self.class.name end class << self # Public: Default instrumentation service for new pipeline objects. attr_accessor :default_instrumentation_service end def initialize(filters, default_context = {}, result_class = nil) raise ArgumentError, 'default_context cannot be nil' if default_context.nil? @filters = filters.flatten.freeze @default_context = default_context.freeze @result_class = result_class || Hash @instrumentation_service = self.class.default_instrumentation_service end # Apply all filters in the pipeline to the given HTML. # # html - A String containing HTML or a DocumentFragment object. # context - The context hash passed to each filter. See the Filter docs # for more info on possible values. This object MUST NOT be modified # in place by filters. Use the Result for passing state back. # result - The result Hash passed to each filter for modification. This # is where Filters store extracted information from the content. # # Returns the result Hash after being filtered by this Pipeline. Contains an # :output key with the DocumentFragment or String HTML markup based on the # output of the last filter in the pipeline. def call(html, context = {}, result = nil) context = @default_context.merge(context) context = context.freeze result ||= @result_class.new payload = default_payload filters: @filters.map(&:name), context: context, result: result instrument 'call_pipeline.html_pipeline', payload do result[:output] = @filters.inject(html) do |doc, filter| perform_filter(filter, doc, context, result) end end result end # Internal: Applies a specific filter to the supplied doc. # # The filter is instrumented. # # Returns the result of the filter. def perform_filter(filter, doc, context, result) payload = default_payload filter: filter.name, context: context, result: result instrument 'call_filter.html_pipeline', payload do filter.call(doc, context, result) end end # Like call but guarantee the value returned is a DocumentFragment. # Pipelines may return a DocumentFragment or a String. Callers that need a # DocumentFragment should use this method. def to_document(input, context = {}, result = nil) result = call(input, context, result) HTML::Pipeline.parse(result[:output]) end # Like call but guarantee the value returned is a string of HTML markup. def to_html(input, context = {}, result = nil) result = call(input, context, result = nil) output = result[:output] if output.respond_to?(:to_html) output.to_html else output.to_s end end # Public: setup instrumentation for this pipeline. # # Returns nothing. def setup_instrumentation(name = nil, service = nil) self.instrumentation_name = name self.instrumentation_service = service || self.class.default_instrumentation_service end # Internal: if the `instrumentation_service` object is set, instruments the # block, otherwise the block is ran without instrumentation. # # Returns the result of the provided block. def instrument(event, payload = nil) payload ||= default_payload return yield(payload) unless instrumentation_service instrumentation_service.instrument event, payload do |payload| yield payload end end # Internal: Default payload for instrumentation. # # Accepts a Hash of additional payload data to be merged. # # Returns a Hash. def default_payload(payload = {}) { pipeline: instrumentation_name }.merge(payload) end end end # XXX nokogiri monkey patches for 1.8 unless ''.respond_to?(:force_encoding) class Nokogiri::XML::Node # Work around an issue with utf-8 encoded data being erroneously converted to # ... some other shit when replacing text nodes. See 'utf-8 output 2' in # user_content_test.rb for details. def replace_with_encoding_fix(replacement) if replacement.respond_to?(:to_str) replacement = document.fragment("
#{replacement}
").children.first.children end replace_without_encoding_fix(replacement) end alias replace_without_encoding_fix replace alias replace replace_with_encoding_fix def swap(replacement) replace(replacement) self end end end html-pipeline-2.14.3/lib/html/pipeline/000077500000000000000000000000001432233603200176655ustar00rootroot00000000000000html-pipeline-2.14.3/lib/html/pipeline/@mention_filter.rb000066400000000000000000000116601432233603200233340ustar00rootroot00000000000000# frozen_string_literal: true require 'set' module HTML class Pipeline # HTML filter that replaces @user mentions with links. Mentions within
,
    # , and  elements are ignored. Mentions that reference users that do
    # not exist are ignored.
    #
    # Context options:
    #   :base_url - Used to construct links to user profile pages for each
    #               mention.
    #   :info_url - Used to link to "more info" when someone mentions @mention
    #               or @mentioned.
    #   :username_pattern - Used to provide a custom regular expression to
    #                       identify usernames
    #
    class MentionFilter < Filter
      # Public: Find user @mentions in text.  See
      # MentionFilter#mention_link_filter.
      #
      #   MentionFilter.mentioned_logins_in(text) do |match, login, is_mentioned|
      #     "#{login}"
      #   end
      #
      # text - String text to search.
      #
      # Yields the String match, the String login name, and a Boolean determining
      # if the match = "@mention[ed]".  The yield's return replaces the match in
      # the original text.
      #
      # Returns a String replaced with the return of the block.
      def self.mentioned_logins_in(text, username_pattern = UsernamePattern)
        text.gsub MentionPatterns[username_pattern] do |match|
          login = Regexp.last_match(1)
          yield match, login, MentionLogins.include?(login.downcase)
        end
      end

      # Hash that contains all of the mention patterns used by the pipeline
      MentionPatterns = Hash.new do |hash, key|
        hash[key] = /
          (?:^|\W)                    # beginning of string or non-word char
          @((?>#{key}))  # @username
          (?!\/)                      # without a trailing slash
          (?=
            \.+[ \t\W]|               # dots followed by space or non-word character
            \.+$|                     # dots at end of line
            [^0-9a-zA-Z_.]|           # non-word character except dot
            $                         # end of line
          )
        /ix
      end

      # Default pattern used to extract usernames from text. The value can be
      # overriden by providing the username_pattern variable in the context.
      UsernamePattern = /[a-z0-9][a-z0-9-]*/

      # List of username logins that, when mentioned, link to the blog post
      # about @mentions instead of triggering a real mention.
      MentionLogins = %w[
        mention
        mentions
        mentioned
        mentioning
      ].freeze

      # Don't look for mentions in text nodes that are children of these elements
      IGNORE_PARENTS = %w(pre code a style script).to_set

      def call
        result[:mentioned_usernames] ||= []

        doc.search('.//text()').each do |node|
          content = node.to_html
          next unless content.include?('@')
          next if has_ancestor?(node, IGNORE_PARENTS)
          html = mention_link_filter(content, base_url, info_url, username_pattern)
          next if html == content
          node.replace(html)
        end
        doc
      end

      # The URL to provide when someone @mentions a "mention" name, such
      # as @mention or @mentioned, that will give them more info on mentions.
      def info_url
        context[:info_url] || nil
      end

      def username_pattern
        context[:username_pattern] || UsernamePattern
      end

      # Replace user @mentions in text with links to the mentioned user's
      # profile page.
      #
      # text      - String text to replace @mention usernames in.
      # base_url  - The base URL used to construct user profile URLs.
      # info_url  - The "more info" URL used to link to more info on @mentions.
      #             If nil we don't link @mention or @mentioned.
      # username_pattern  - Regular expression used to identify usernames in
      #                     text
      #
      # Returns a string with @mentions replaced with links. All links have a
      # 'user-mention' class name attached for styling.
      def mention_link_filter(text, _base_url = '/', info_url = nil, username_pattern = UsernamePattern)
        self.class.mentioned_logins_in(text, username_pattern) do |match, login, is_mentioned|
          link =
            if is_mentioned
              link_to_mention_info(login, info_url)
            else
              link_to_mentioned_user(login)
            end

          link ? match.sub("@#{login}", link) : match
        end
      end

      def link_to_mention_info(text, info_url = nil)
        return "@#{text}" if info_url.nil?
        "" \
          "@#{text}" \
          ''
      end

      def link_to_mentioned_user(login)
        result[:mentioned_usernames] |= [login]

        url = base_url.dup
        url << '/' unless url =~ /[\/~]\z/

        "" \
          "@#{login}" \
          ''
      end
    end
  end
end
html-pipeline-2.14.3/lib/html/pipeline/@team_mention_filter.rb000066400000000000000000000065041432233603200243430ustar00rootroot00000000000000# frozen_string_literal: true

require 'set'

module HTML
  class Pipeline
    # HTML filter that replaces @org/team mentions with links. Mentions within
    # 
, , , '
    assert_equal body, filter(body).to_html
  end

  def test_not_replacing_mentions_in_links
    body = '

@kneath okay

' assert_equal body, filter(body).to_html end def test_entity_encoding_and_whatnot body = "

@kneath what's up

" link = '@kneath' assert_equal "

#{link} what's up

", filter(body, '/').to_html end def test_html_injection body = '

@kneath <script>alert(0)</script>

' link = '@kneath' assert_equal "

#{link} <script>alert(0)</script>

", filter(body, '/').to_html end def test_links_to_nothing_when_no_info_url_given body = '

How do I @mention someone?

' assert_equal '

How do I @mention someone?

', filter(body, '/').to_html end def test_links_to_more_info_when_info_url_given body = '

How do I @mention someone?

' link = '@mention' assert_equal "

How do I #{link} someone?

", filter(body, '/', 'https://github.com/blog/821').to_html end def test_base_url_slash body = '

Hi, @jch!

' link = '@jch' assert_equal "

Hi, #{link}!

", filter(body, '/').to_html end def test_base_url_under_custom_route body = '

Hi, @jch!

' link = '@jch' assert_equal "

Hi, #{link}!

", filter(body, '/userprofile').to_html end def test_base_url_slash_with_tilde body = '

Hi, @jch!

' link = '@jch' assert_equal "

Hi, #{link}!

", filter(body, '/~').to_html end MarkdownPipeline = HTML::Pipeline.new [ HTML::Pipeline::MarkdownFilter, HTML::Pipeline::MentionFilter ] def mentioned_usernames result = {} MarkdownPipeline.call(@body, {}, result) result[:mentioned_usernames] end def test_matches_usernames_in_body @body = '@test how are you?' assert_equal %w[test], mentioned_usernames end def test_matches_usernames_with_dashes @body = 'hi @some-user' assert_equal %w[some-user], mentioned_usernames end def test_matches_usernames_followed_by_a_single_dot @body = 'okay @some-user.' assert_equal %w[some-user], mentioned_usernames end def test_matches_usernames_followed_by_multiple_dots @body = 'okay @some-user...' assert_equal %w[some-user], mentioned_usernames end def test_does_not_match_email_addresses @body = 'aman@tmm1.net' assert_equal [], mentioned_usernames end def test_does_not_match_domain_name_looking_things @body = 'we need a @github.com email' assert_equal [], mentioned_usernames end def test_does_not_match_organization_team_mentions @body = 'we need to @github/enterprise know' assert_equal [], mentioned_usernames end def test_matches_colon_suffixed_names @body = '@tmm1: what do you think?' assert_equal %w[tmm1], mentioned_usernames end def test_matches_list_of_names @body = '@defunkt @atmos @kneath' assert_equal %w[defunkt atmos kneath], mentioned_usernames end def test_matches_list_of_names_with_commas @body = '/cc @defunkt, @atmos, @kneath' assert_equal %w[defunkt atmos kneath], mentioned_usernames end def test_matches_inside_brackets @body = '(@mislav) and [@rtomayko]' assert_equal %w[mislav rtomayko], mentioned_usernames end def test_doesnt_ignore_invalid_users @body = '@defunkt @mojombo and @somedude' assert_equal %w[defunkt mojombo somedude], mentioned_usernames end def test_returns_distinct_set @body = '/cc @defunkt, @atmos, @kneath, @defunkt, @defunkt' assert_equal %w[defunkt atmos kneath], mentioned_usernames end def test_does_not_match_inline_code_block_with_multiple_code_blocks @body = "something\n\n`/cc @defunkt @atmos @kneath` `/cc @atmos/atmos`" assert_equal %w[], mentioned_usernames end def test_mention_at_end_of_parenthetical_sentence @body = "(We're talking 'bout @ymendel.)" assert_equal %w[ymendel], mentioned_usernames end def test_username_pattern_can_be_customized body = '

@_abc: test.

' doc = Nokogiri::HTML::DocumentFragment.parse(body) res = filter(doc, '/', nil, /(_[a-z]{3})/) link = '@_abc' assert_equal "

#{link}: test.

", res.to_html end def test_filter_does_not_create_a_new_object_for_default_username_pattern body = '
@test
' doc = Nokogiri::HTML::DocumentFragment.parse(body) filter(doc.clone, '/', nil) pattern_count = HTML::Pipeline::MentionFilter::MentionPatterns.length filter(doc.clone, '/', nil) assert_equal pattern_count, HTML::Pipeline::MentionFilter::MentionPatterns.length filter(doc.clone, '/', nil, /test/) assert_equal pattern_count + 1, HTML::Pipeline::MentionFilter::MentionPatterns.length end def test_mention_link_filter filter = HTML::Pipeline::MentionFilter.new nil expected = "@hubot" assert_equal expected, filter.mention_link_filter('@hubot') end end html-pipeline-2.14.3/test/html/pipeline/plain_text_input_filter_test.rb000066400000000000000000000013571432233603200264230ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' class HTML::Pipeline::PlainTextInputFilterTest < Minitest::Test PlainTextInputFilter = HTML::Pipeline::PlainTextInputFilter def test_fails_when_given_a_documentfragment body = '

heyo

' doc = Nokogiri::HTML::DocumentFragment.parse(body) assert_raises(TypeError) { PlainTextInputFilter.call(doc, {}) } end def test_wraps_input_in_a_div_element doc = PlainTextInputFilter.call('howdy pahtner', {}) assert_equal '
howdy pahtner
', doc.to_s end def test_html_escapes_plain_text_input doc = PlainTextInputFilter.call('See: ', {}) assert_equal '
See: <http://example.org>
', doc.to_s end end html-pipeline-2.14.3/test/html/pipeline/require_helper_test.rb000066400000000000000000000017251432233603200245020ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' class HTML::Pipeline::RequireHelperTest < Minitest::Test def test_works_with_existing HTML::Pipeline.require_dependency('rake', 'SomeClass') end def test_raises_mising_dependency_error assert_raises HTML::Pipeline::MissingDependencyError do HTML::Pipeline.require_dependency('non-existant', 'SomeClass') end end def test_raises_error_including_message error = assert_raises(HTML::Pipeline::MissingDependencyError) do HTML::Pipeline.require_dependency('non-existant', 'SomeClass') end assert_includes(error.message, "Missing dependency 'non-existant' for SomeClass. See README.md for details.") end def test_raises_error_includes_underlying_message error = assert_raises HTML::Pipeline::MissingDependencyError do HTML::Pipeline.require_dependency('non-existant', 'SomeClass') end assert_includes(error.message, 'LoadError: cannot load such file') end end html-pipeline-2.14.3/test/html/pipeline/sanitization_filter_test.rb000066400000000000000000000141141432233603200255440ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' class HTML::Pipeline::SanitizationFilterTest < Minitest::Test SanitizationFilter = HTML::Pipeline::SanitizationFilter def test_removing_script_tags orig = %(

) html = SanitizationFilter.call(orig).to_s refute_match /script/, html end def test_removing_style_tags orig = %(

) html = SanitizationFilter.call(orig).to_s refute_match /style/, html end def test_removing_style_attributes orig = %(

YO DAWG

) html = SanitizationFilter.call(orig).to_s refute_match /font-size/, html refute_match /style/, html end def test_removing_script_event_handler_attributes orig = %(YO DAWG) html = SanitizationFilter.call(orig).to_s refute_match /javscript/, html refute_match /onclick/, html end def test_sanitizes_li_elements_not_contained_in_ul_or_ol stuff = "a\n
  • b
  • \nc" html = SanitizationFilter.call(stuff).to_s assert_equal "a\nb\nc", html end def test_does_not_sanitize_li_elements_contained_in_ul_or_ol stuff = "a\n
    • b
    \nc" assert_equal stuff, SanitizationFilter.call(stuff).to_s end def test_github_specific_protocols_are_not_removed stuff = 'Spill this yo and so on' assert_equal stuff, SanitizationFilter.call(stuff).to_s end def test_unknown_schemes_are_removed stuff = 'Wat is this' html = SanitizationFilter.call(stuff).to_s assert_equal 'Wat is this', html end def test_allowlisted_longdesc_schemes_are_allowed stuff = '' html = SanitizationFilter.call(stuff).to_s assert_equal '', html end def test_weird_longdesc_schemes_are_removed stuff = '' html = SanitizationFilter.call(stuff).to_s assert_equal '', html end def test_standard_schemes_are_removed_if_not_specified_in_anchor_schemes stuff = 'No href for you' filter = SanitizationFilter.new(stuff, anchor_schemes: []) html = filter.call.to_s assert_equal 'No href for you', html end def test_custom_anchor_schemes_are_not_removed stuff = 'Wat is this' filter = SanitizationFilter.new(stuff, anchor_schemes: ['something-weird']) html = filter.call.to_s assert_equal stuff, html end def test_anchor_schemes_are_merged_with_other_anchor_restrictions stuff = 'Wat is this' allowlist = { elements: ['a'], attributes: { 'a' => %w[href ping] }, protocols: { 'a' => { 'ping' => ['http'] } } } filter = SanitizationFilter.new(stuff, allowlist: allowlist, anchor_schemes: ['something-weird']) html = filter.call.to_s assert_equal 'Wat is this', html end def test_uses_anchor_schemes_from_allowlist_when_not_separately_specified stuff = 'Wat is this' allowlist = { elements: ['a'], attributes: { 'a' => ['href'] }, protocols: { 'a' => { 'href' => ['something-weird'] } } } filter = SanitizationFilter.new(stuff, allowlist: allowlist) html = filter.call.to_s assert_equal stuff, html end def test_allowlist_contains_default_anchor_schemes assert_equal SanitizationFilter::ALLOWLIST[:protocols]['a']['href'], ['http', 'https', 'mailto', 'xmpp', :relative, 'github-windows', 'github-mac', 'irc', 'ircs'] end def test_allowlist_from_full_constant stuff = 'Wat is this' filter = SanitizationFilter.new(stuff, allowlist: SanitizationFilter::FULL) html = filter.call.to_s assert_equal 'Wat is this', html end def test_exports_default_anchor_schemes assert_equal SanitizationFilter::ANCHOR_SCHEMES, ['http', 'https', 'mailto', 'xmpp', :relative, 'github-windows', 'github-mac', 'irc', 'ircs'] end def test_script_contents_are_removed orig = '' assert_equal '', SanitizationFilter.call(orig).to_s end def test_table_rows_and_cells_removed_if_not_in_table orig = %(FooBar) assert_equal 'FooBar', SanitizationFilter.call(orig).to_s end def test_table_sections_removed_if_not_in_table orig = %(Foo) assert_equal 'Foo', SanitizationFilter.call(orig).to_s end def test_table_sections_are_not_removed orig = %(
    Column 1
    Sum
    1
    ) assert_equal orig, SanitizationFilter.call(orig).to_s end def test_summary_tag_are_not_removed orig = %(Foo) assert_equal orig, SanitizationFilter.call(orig).to_s end def test_details_tag_and_open_attribute_are_not_removed orig = %(
    Foo
    ) assert_equal orig, SanitizationFilter.call(orig).to_s end def test_nested_details_tag_are_not_removed orig = <<-NESTED
    Foo
    Bar Baz
    Qux
    NESTED assert_equal orig, SanitizationFilter.call(orig).to_s end def test_deprecated_whitelist_context orig = %(

    ) context = { whitelist: ['table'] } assert_equal ['table'], SanitizationFilter.new(orig, context).allowlist end def test_deprecation_warning_whitelist orig = %(

    ) _stdout, stderror = capture_io do SanitizationFilter.new(orig).whitelist end assert_match "[DEPRECATION] 'whitelist' is deprecated. Please use 'allowlist' instead.", stderror end end html-pipeline-2.14.3/test/html/pipeline/syntax_highlight_filter_test.rb000066400000000000000000000034131432233603200264050ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' require 'escape_utils' SyntaxHighlightFilter = HTML::Pipeline::SyntaxHighlightFilter class HTML::Pipeline::SyntaxHighlightFilterTest < Minitest::Test def test_highlight_default filter = SyntaxHighlightFilter.new \ '
    hello
    ', highlight: 'coffeescript' doc = filter.call assert !doc.css('.highlight').empty? assert !doc.css('.highlight-coffeescript').empty? end def test_highlight_default_will_not_override filter = SyntaxHighlightFilter.new \ "
    hello
    ", highlight: 'coffeescript' doc = filter.call assert doc.css('.highlight-coffeescript').empty? assert !doc.css('.highlight-c').empty? end def test_highlight_does_not_remove_pre_tag filter = SyntaxHighlightFilter.new \ "
    hello
    ", highlight: 'coffeescript' doc = filter.call assert !doc.css('pre').empty? end def test_highlight_allows_optional_scope filter = SyntaxHighlightFilter.new \ "
    hello
    ", highlight: 'coffeescript', scope: 'test-scope' doc = filter.call assert !doc.css('pre.test-scope').empty? end def test_highlight_keeps_the_pre_tags_lang filter = SyntaxHighlightFilter.new \ "
    hello
    ", highlight: 'coffeescript' doc = filter.call assert !doc.css('pre[lang=c]').empty? end def test_highlight_handles_nested_pre_tags inner_code = "
    console.log('i am nested!')
    " escaped = CGI.escape_html(inner_code) html = "
    #{escaped}
    " filter = SyntaxHighlightFilter.new html, highlight: 'html' doc = filter.call assert_equal 2, doc.css('span[class=nt]').length assert_equal CGI.unescape_html(escaped), doc.inner_text end end html-pipeline-2.14.3/test/html/pipeline/team_mention_filter_test.rb000066400000000000000000000141711432233603200255120ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' class HTML::Pipeline::TeamMentionFilterTest < Minitest::Test def filter(html, base_url = '/', team_pattern = nil) HTML::Pipeline::TeamMentionFilter.call(html, base_url: base_url, team_pattern: team_pattern) end def test_filtering_plain_text body = '

    @github/team: check it out.

    ' res = filter(body, '/') link = '@github/team' assert_equal "

    #{link}: check it out.

    ", res.to_html end def test_filtering_a_documentfragment body = '

    @github/team: check it out.

    ' doc = Nokogiri::HTML::DocumentFragment.parse(body) res = filter(doc, '/') assert_same doc, res link = '@github/team' assert_equal "

    #{link}: check it out.

    ", res.to_html end def test_not_replacing_mentions_in_pre_tags body = '
    @github/team: okay
    ' assert_equal body, filter(body).to_html end def test_not_replacing_mentions_in_code_tags body = '

    @github/team: okay

    ' assert_equal body, filter(body).to_html end def test_not_replacing_mentions_in_style_tags body = '' assert_equal body, filter(body).to_html end def test_not_replacing_mentions_in_links body = '

    @github/team okay

    ' assert_equal body, filter(body).to_html end def test_entity_encoding_and_whatnot body = "

    @github/team what's up

    " link = '@github/team' assert_equal "

    #{link} what's up

    ", filter(body, '/').to_html end def test_html_injection body = '

    @github/team <script>alert(0)</script>

    ' link = '@github/team' assert_equal "

    #{link} <script>alert(0)</script>

    ", filter(body, '/').to_html end def test_links_to_nothing_with_user_mention body = '

    Hi, @kneath

    ' assert_equal '

    Hi, @kneath

    ', filter(body, '/').to_html end def test_base_url_slash body = '

    Hi, @github/team!

    ' link = '@github/team' assert_equal "

    Hi, #{link}!

    ", filter(body, '/').to_html end def test_base_url_under_custom_route body = '

    Hi, @org/team!

    ' link = '@org/team' assert_equal "

    Hi, #{link}!

    ", filter(body, 'www.github.com').to_html end def test_base_url_slash_with_tilde body = '

    Hi, @github/team!

    ' link = '@github/team' assert_equal "

    Hi, #{link}!

    ", filter(body, '/~').to_html end def test_multiple_team_mentions body = '

    Hi, @github/whale and @github/donut!

    ' link_whale = '@github/whale' link_donut = '@github/donut' assert_equal "

    Hi, #{link_whale} and #{link_donut}!

    ", filter(body).to_html end MarkdownPipeline = HTML::Pipeline.new [ HTML::Pipeline::MarkdownFilter, HTML::Pipeline::TeamMentionFilter ] def mentioned_teams result = {} MarkdownPipeline.call(@body, {}, result) result[:mentioned_teams] end def test_matches_teams_in_body @body = '@test/team how are you?' assert_equal %w[team], mentioned_teams end def test_matches_orgs_with_dashes @body = 'hi @some-org/team' assert_equal %w[team], mentioned_teams end def test_matches_teams_with_dashes @body = 'hi @github/some-team' assert_equal %w[some-team], mentioned_teams end def test_matches_teams_followed_by_a_single_dot @body = 'okay @github/team.' assert_equal %w[team], mentioned_teams end def test_matches_teams_followed_by_multiple_dots @body = 'okay @github/team...' assert_equal %w[team], mentioned_teams end def test_does_not_match_email_addresses @body = 'aman@tmm1.net' assert_equal [], mentioned_teams end def test_does_not_match_domain_name_looking_things @body = 'we need a @github.com email' assert_equal [], mentioned_teams end def test_does_not_match_user_mentions @body = 'we need to @enterprise know' assert_equal [], mentioned_teams end def test_matches_colon_suffixed_team_names @body = '@github/team: what do you think?' assert_equal %w[team], mentioned_teams end def test_matches_list_of_teams @body = '@github/whale @github/donut @github/green' assert_equal %w[whale donut green], mentioned_teams end def test_matches_list_of_teams_with_commas @body = '/cc @github/whale, @github/donut, @github/green' assert_equal %w[whale donut green], mentioned_teams end def test_matches_inside_brackets @body = '(@github/whale) and [@github/donut]' assert_equal %w[whale donut], mentioned_teams end def test_returns_distinct_set @body = '/cc @github/whale, @github/donut, @github/whale, @github/whale' assert_equal %w[whale donut], mentioned_teams end def test_does_not_match_inline_code_block_with_multiple_code_blocks @body = "something\n\n`/cc @github/whale @github/donut @github/green` `/cc @donut/donut`" assert_equal %w[], mentioned_teams end def test_mention_at_end_of_parenthetical_sentence @body = "(We're talking 'bout @some-org/some-team.)" assert_equal %w[some-team], mentioned_teams end def test_team_pattern_can_be_customized body = '

    @_abc/XYZ: test

    ' doc = Nokogiri::HTML::DocumentFragment.parse(body) res = filter(doc, '/', /@(_[a-z]{3})\/([A-Z]{3})/) link = '@_abc/XYZ' assert_equal "

    #{link}: test

    ", res.to_html end def test_mention_link_filter filter = HTML::Pipeline::TeamMentionFilter.new nil expected = "@bot/hubot" assert_equal expected, filter.mention_link_filter('@bot/hubot') end end html-pipeline-2.14.3/test/html/pipeline/toc_filter_test.rb000066400000000000000000000123431432233603200236170ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' class HTML::Pipeline::TableOfContentsFilterTest < Minitest::Test TocFilter = HTML::Pipeline::TableOfContentsFilter TocPipeline = HTML::Pipeline.new [ HTML::Pipeline::TableOfContentsFilter ] def toc result = {} TocPipeline.call(@orig, {}, result) result[:toc] end def test_anchors_are_added_properly orig = %(

    Ice cube

    Will swarm on any motherfucker in a blue uniform

    ) assert_includes TocFilter.call(orig).to_s, 'Ice cube

    Will swarm on any motherfucker in a blue uniform

    ) assert_includes toc, %(
    ) assert_equal expected, rendered_toc end end end html-pipeline-2.14.3/test/html/pipeline_test.rb000066400000000000000000000045061432233603200214670ustar00rootroot00000000000000# frozen_string_literal: true require 'test_helper' require 'helpers/mocked_instrumentation_service' class HTML::PipelineTest < Minitest::Test Pipeline = HTML::Pipeline class TestFilter def self.call(input, _context, _result) input.reverse end end def setup @context = {} @result_class = Hash @pipeline = Pipeline.new [TestFilter], @context, @result_class end def test_filter_instrumentation service = MockedInstrumentationService.new events = service.subscribe 'call_filter.html_pipeline' @pipeline.instrumentation_service = service filter(body = 'hello') event, payload, res = events.pop assert event, 'event expected' assert_equal 'call_filter.html_pipeline', event assert_equal TestFilter.name, payload[:filter] assert_equal @pipeline.class.name, payload[:pipeline] assert_equal body.reverse, payload[:result][:output] end def test_pipeline_instrumentation service = MockedInstrumentationService.new events = service.subscribe 'call_pipeline.html_pipeline' @pipeline.instrumentation_service = service filter(body = 'hello') event, payload, res = events.pop assert event, 'event expected' assert_equal 'call_pipeline.html_pipeline', event assert_equal @pipeline.filters.map(&:name), payload[:filters] assert_equal @pipeline.class.name, payload[:pipeline] assert_equal body.reverse, payload[:result][:output] end def test_default_instrumentation_service service = 'default' Pipeline.default_instrumentation_service = service pipeline = Pipeline.new [], @context, @result_class assert_equal service, pipeline.instrumentation_service ensure Pipeline.default_instrumentation_service = nil end def test_setup_instrumentation assert_nil @pipeline.instrumentation_service service = MockedInstrumentationService.new events = service.subscribe 'call_pipeline.html_pipeline' @pipeline.setup_instrumentation name = 'foo', service assert_equal service, @pipeline.instrumentation_service assert_equal name, @pipeline.instrumentation_name filter(body = 'foo') event, payload, res = events.pop assert event, 'expected event' assert_equal name, payload[:pipeline] assert_equal body.reverse, payload[:result][:output] end def filter(input) @pipeline.call(input) end end html-pipeline-2.14.3/test/test_helper.rb000066400000000000000000000010461432233603200201710ustar00rootroot00000000000000# frozen_string_literal: true require 'bundler/setup' require 'html/pipeline' require 'minitest/autorun' require 'minitest/pride' require 'minitest/focus' require 'active_support/core_ext/string' module TestHelpers # Asserts that two html fragments are equivalent. Attribute order # will be ignored. def assert_equal_html(expected, actual) assert_equal Nokogiri::HTML::DocumentFragment.parse(expected).to_hash, Nokogiri::HTML::DocumentFragment.parse(actual).to_hash end end Minitest::Test.send(:include, TestHelpers)