Sha256: 0eb8861875842d9340cbe3a10861d75583f679b54be441d28db3a55fa2d79b7a
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
# frozen_string_literal: true module Cosensee class TailwindRenderer ParsedLine = Data.define(:content) do include HtmlEncodable def render result = if content.line_content? TailwindRenderer.new(content: content.line_content).render else content.content.map do |c| if c.is_a?(String) escape_html(c) else TailwindRenderer.new(content: c).render end end.join end level = content.indent_level * 2 result = ' ' if result == '' if level > 0 %(<div class="relative pl-[#{level}rem]"><span class="absolute left-[#{level - 1}rem] top-1/2 -translate-y-1/2 w-1.5 h-1.5 rounded-full bg-gray-800"></span>#{result}</div>) else %(<div class="relative pl-[#{level}rem]">#{result}</div>) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cosensee-0.6.0 | lib/cosensee/tailwind_renderer/parsed_line.rb |