Sha256: f389242da4b100f181e230843453ad03022833d34c5666bf5fa06d869ec5dc89

Contents?: true

Size: 625 Bytes

Versions: 7

Compression:

Stored size: 625 Bytes

Contents

require 'middleman-core/renderers/redcarpet'

module GovukTechDocs
  class TechDocsHTMLRenderer < Middleman::Renderers::MiddlemanRedcarpetHTML
    include Redcarpet::Render::SmartyPants

    def header(text, level)
      anchor = UniqueIdentifierGenerator.instance.create(text, level)
      %(<h#{level} id="#{anchor}">#{text}</h#{level}>)
    end

    def image(link, *args)
      %(<a href="#{link}" target="_blank" rel="noopener noreferrer">#{super}</a>)
    end

    def table(header, body)
      %(<div class="table-container">
        <table>
          #{header}#{body}
        </table>
      </div>)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
govuk_tech_docs-1.5.0 lib/govuk_tech_docs/tech_docs_html_renderer.rb
govuk_tech_docs-1.4.0 lib/govuk_tech_docs/tech_docs_html_renderer.rb
govuk_tech_docs-1.3.1 lib/govuk_tech_docs/tech_docs_html_renderer.rb
govuk_tech_docs-1.3.0 lib/govuk_tech_docs/tech_docs_html_renderer.rb
govuk_tech_docs-1.2.0 lib/govuk_tech_docs/tech_docs_html_renderer.rb
govuk_tech_docs-1.1.0 lib/govuk_tech_docs/tech_docs_html_renderer.rb
govuk_tech_docs-1.0.0 lib/govuk_tech_docs/tech_docs_html_renderer.rb