You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. User can specify a hash `context[:img_attrs]` to change the `img` tag
attributes, e.g. `{ "draggable" => false }`
2. The hash key can be either `String` / `Symbol` (indifferent access)
`{ "draggable" => false }` / `{ draggable: false }`
=>
`<img draggable="false">`
3. The hash value can be either anything / proc-like object
Proc-like object with default argument `name`:
Given name is `:shipit:`
`{ title: ->(name) { |n| n.gsub(":", "") } }`
=>
`<img title="shipit">`
So you can do any customisations with the attribute.
4. The hash value nil means clear the attribute of img tag
For example, to clear the default `height`, `width`, and `align`
attributes, pass `{ height: nil, width: nil, align: nil }` to
`context[:img_attrs]`.
5. Refine tests with consistent styles
Copy file name to clipboardexpand all lines: lib/html/pipeline/emoji_filter.rb
+22-1
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ class Pipeline
14
14
# :asset_root (required) - base url to link to emoji sprite
15
15
# :asset_path (optional) - url path to link to emoji sprite. :file_name can be used as a placeholder for the sprite file name. If no asset_path is set "emoji/:file_name" is used.
16
16
# :ignored_ancestor_tags (optional) - Tags to stop the emojification. Node has matched ancestor HTML tags will not be emojified. Default to pre, code, and tt tags. Extra tags please pass in the form of array, e.g., %w(blockquote summary).
17
+
# :img_attrs (optional) - Attributes for generated img tag. E.g. Pass { "draggble" => true, "height" => nil } to set draggable attribute to "true" and clear height attribute of generated img tag.
0 commit comments