Sha256: ba9f6c1f370c56803c135d76bca98cb8e91e0be73a90385a262a1a78a4721326
Contents?: true
Size: 809 Bytes
Versions: 2
Compression:
Stored size: 809 Bytes
Contents
# frozen_string_literal: true module Decidim module ContentRenderers # A renderer that converts URLs to links and strips attributes in anchors. # # Examples: # `<a href="http://urls.net" onmouseover="alert('hello')">URLs</a>` # Gets rendered as: # `<a href="https://decidim.org" target="_blank" rel="noopener">https://decidim.org</a>` # And: # `<a href="javascript:document.cookies">click me</a>` # Gets rendered as: # `click me` # # @see BaseRenderer Examples of how to use a content renderer class LinkRenderer < BaseRenderer # @return [String] the content ready to display (contains HTML) def render(options = { target: "_blank", rel: "nofollow noopener" }) Anchored::Linker.auto_link(content, options) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.22.0 | lib/decidim/content_renderers/link_renderer.rb |
decidim-core-0.21.0 | lib/decidim/content_renderers/link_renderer.rb |