Q:

Missing context keys for HTML::Pipeline::EmojiFilter: :asset_root

I'm with a Rails 5 application and adding html_pipeline gem with the EmojiFilter extension so that I can process the text sent by the users and filter the emojies.
I have the following:
def filtered_content
    pipeline = HTML::Pipeline.new [
     HTML::Pipeline::PlainTextInputFilter,
     HTML::Pipeline::MarkdownFilter,
     HTML::Pipeline::SanitizationFilter,
     HTML::Pipeline::AutolinkFilter,
     HTML::Pipeline::EmojiFilter
    ]
   pipeline.call(content)[:output].to_s
end

I followed the usual steps adding the gemoji gem so that I can use the EmojiFilter, but when I add it to the pipeline declaration and try to use the pipeline I get the error:
Missing context keys for HTML::Pipeline::EmojiFilter: :asset_root

I added this on my assets.rb initializer:
  Rails.application.config.assets.paths << Emoji.images_path
  Rails.application.config.assets.precompile << "emoji/**/*.png"

And also ran "rake emoji" but the error is still there.
Any ideas of I could solve this?
Thanks!

A:

Ok I got feedback from html_pipeline collaborators. Basically what needs to be done to solve this is to add the context variable asset_root to indicate where the images should be read from (a local folder, a CDN url, etc.)
So the modified code on my question should be modified like this:
def filtered_content
    pipeline = HTML::Pipeline.new [
      HTML::Pipeline::PlainTextInputFilter,
      HTML::Pipeline::MarkdownFilter,
      HTML::Pipeline::SanitizationFilter,
      HTML::Pipeline::AutolinkFilter,
      HTML::Pipeline::EmojiFilter
    ], { asset_root: "the url of your assets" } # <------
    # E.g. GitHub uses this: "https://assets-cdn.github.com/images/icons/emoji/unicode"
    pipeline.call(content)[:output].to_s
end

