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 +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/govuk_markdown.rb +1 -1
- data/lib/govuk_markdown/renderer.rb +29 -0
- data/lib/govuk_markdown/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6479fefb7a458cfffb3576bdb7b26a0001280c4aeb5451ad41cf8cf591f92d99
|
4
|
+
data.tar.gz: 0f07eef7eec6c89405192995e0dc16f550ec8b31250a3e337373a90d5e473b49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13724c7fb419e7e696ad312146af83da0cd51b984e85f8da9c1ce332fd0bf75bf0a63e1a41f92442875b4d5652c9b7a7bc3aa9f9dd756cf0e9660caf5f67a6c5
|
7
|
+
data.tar.gz: b8e98b9319f2101fae7faa7eb9b06395e99f1095fc47f1690b27f52d0e9d0c8adddf04ad0911b22f963e7eb8833f5421fd8b08b275ea02be04740c9cc532bd97
|
data/CHANGELOG.md
ADDED
@@ -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).
|
data/Gemfile.lock
CHANGED
data/lib/govuk_markdown.rb
CHANGED
@@ -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"
|
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.
|
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
|