lib/govuk_markdown/renderer.rb in govuk_markdown-0.2.0 vs lib/govuk_markdown/renderer.rb in govuk_markdown-0.3.0
- old
+ new
@@ -1,6 +1,35 @@
module GovukMarkdown
class Renderer < ::Redcarpet::Render::HTML
+ def table(header, body)
+ <<~HTML
+ <table class='govuk-table'>
+ <thead class='govuk-table__head'>
+ #{header}
+ </thead>
+ <tbody class='govuk-table__body'>
+ #{body}
+ </tbody>
+ </table>
+ HTML
+ end
+
+ def table_row(content)
+ <<~HTML
+ <tr class='govuk-table__row'>
+ #{content}
+ </tr>
+ HTML
+ end
+
+ def table_cell(content, _alignment)
+ <<~HTML
+ <td class='govuk-table__cell'>
+ #{content}
+ </td>
+ HTML
+ end
+
def header(text, header_level)
heading_size = case header_level
when 1 then "xl"
when 2 then "l"
when 3 then "m"