class Storyblok::Richtext::Marks::Link

Public Instance Methods

matching() click to toggle source
# File lib/storyblok/richtext/html_renderer/marks/link.rb, line 5
def matching
  @node['type'] === 'link'
end
tag() click to toggle source
# File lib/storyblok/richtext/html_renderer/marks/link.rb, line 9
def tag
  attrs = @node['attrs']

  if attrs['anchor'].is_a?(String) and !attrs['anchor'].empty?
    attrs['href'] = "#{attrs['href']}##{attrs['anchor']}"
  end

  [{
    tag: "a",
    attrs: attrs.slice('href', 'target')
  }]
end