govuk_markdown 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5831dad142da4586919e0a8aece9189e4f258a27afdd2397eb74f193e196257
4
- data.tar.gz: 0d5e675b6dbd043434fe2f08aa93c661d30113e4d6c3cbb9a4ef4568c0215045
3
+ metadata.gz: 6479fefb7a458cfffb3576bdb7b26a0001280c4aeb5451ad41cf8cf591f92d99
4
+ data.tar.gz: 0f07eef7eec6c89405192995e0dc16f550ec8b31250a3e337373a90d5e473b49
5
5
  SHA512:
6
- metadata.gz: 3cb6c5ff6f059c940226382e604bb8fe318ff9dc311f37a6126f751859106dc617750987fa94229d6a10af25bb1dab5fd6632dd75df64c3ee786a9e52f57f265
7
- data.tar.gz: 4a5fe7e5b914e221fd3cb39fe2b0c5cb2bf599683ee25c066e9313ff04f6ad500e75ef61c922268a68f34576c91061792b14d3d1b0794fb53b4070dd4ef6ddad
6
+ metadata.gz: 13724c7fb419e7e696ad312146af83da0cd51b984e85f8da9c1ce332fd0bf75bf0a63e1a41f92442875b4d5652c9b7a7bc3aa9f9dd756cf0e9660caf5f67a6c5
7
+ data.tar.gz: b8e98b9319f2101fae7faa7eb9b06395e99f1095fc47f1690b27f52d0e9d0c8adddf04ad0911b22f963e7eb8833f5421fd8b08b275ea02be04740c9cc532bd97
@@ -0,0 +1,7 @@
1
+ ## 0.3.0
2
+
3
+ This release adds support for tables (#3) and avoids the notorious emphasised `snake_cased_words` issue (#4).
4
+
5
+ ## 0.1.0 & 0.2.0
6
+
7
+ Initial release of the code, written by @benilovj and @fofr for the [Get help with tech project](https://github.com/DFE-Digital/get-help-with-tech/pull/171).
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- govuk_markdown (0.2.0)
4
+ govuk_markdown (0.3.0)
5
5
  activesupport
6
6
  redcarpet
7
7
 
@@ -7,6 +7,6 @@ require_relative "./govuk_markdown/renderer"
7
7
  module GovukMarkdown
8
8
  def self.render(markdown)
9
9
  renderer = GovukMarkdown::Renderer.new(with_toc_data: true)
10
- Redcarpet::Markdown.new(renderer).render(markdown).strip
10
+ Redcarpet::Markdown.new(renderer, tables: true, no_intra_emphasis: true).render(markdown).strip
11
11
  end
12
12
  end
@@ -1,5 +1,34 @@
1
1
  module GovukMarkdown
2
2
  class Renderer < ::Redcarpet::Render::HTML
3
+ def table(header, body)
4
+ <<~HTML
5
+ <table class='govuk-table'>
6
+ <thead class='govuk-table__head'>
7
+ #{header}
8
+ </thead>
9
+ <tbody class='govuk-table__body'>
10
+ #{body}
11
+ </tbody>
12
+ </table>
13
+ HTML
14
+ end
15
+
16
+ def table_row(content)
17
+ <<~HTML
18
+ <tr class='govuk-table__row'>
19
+ #{content}
20
+ </tr>
21
+ HTML
22
+ end
23
+
24
+ def table_cell(content, _alignment)
25
+ <<~HTML
26
+ <td class='govuk-table__cell'>
27
+ #{content}
28
+ </td>
29
+ HTML
30
+ end
31
+
3
32
  def header(text, header_level)
4
33
  heading_size = case header_level
5
34
  when 1 then "xl"
@@ -1,3 +1,3 @@
1
1
  module GovukMarkdown
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tijmen Brommet
@@ -93,6 +93,7 @@ files:
93
93
  - ".rspec"
94
94
  - ".rubocop.yml"
95
95
  - ".ruby-version"
96
+ - CHANGELOG.md
96
97
  - Gemfile
97
98
  - Gemfile.lock
98
99
  - README.md