Sha256: 1bf74439696f7eef63bcbb89add354159e220e75fb60b9b8a9b6b0687a5b9f4f
Contents?: true
Size: 781 Bytes
Versions: 1
Compression:
Stored size: 781 Bytes
Contents
# frozen_string_literal: true module Cosensee class TailwindRenderer # codeblock renderer Codeblock = Data.define(:content, :project) do include HtmlEncodable def render title = content.name # !!! EXTENSION: if name ends with .svgtext, render as inline SVG text return InlineSvgText.new(content:, project:).render if title.match?(/\.svgtext$/) <<~HTML_BLOCK <div class="bg-orange-300 text-gray-900 px-4 py-1 rounded-t-lg font-mono text-sm">#{title}</div> <div class="px-4 bg-gray-300 text-gray-900 rounded-b-lg shadow-md"><pre class="overflow-x-auto"><code class="block font-mono text-sm leading-relaxed">#{escape_html(content.content)}</code></pre></div> HTML_BLOCK end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cosensee-0.8.0 | lib/cosensee/tailwind_renderer/codeblock.rb |