govuk_markdown 2.0.0 → 2.0.1

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: c6d0bb270e6c3987985f3da0f956b8a9871c112cc09ca232715a2440773cd8ab
4
- data.tar.gz: 6f34ac1e30578e6c6c912e93fc8c6fd410ace73b73903f7c8141559299832c91
3
+ metadata.gz: 975a784ccde8bc595764bf9bbff9dc0377b00d43e3114a0870f75fb9a74dc828
4
+ data.tar.gz: a648e648e2a72505e45f9100a3f4c7599287cca3c0bdd78fb34d5110cfcac62d
5
5
  SHA512:
6
- metadata.gz: 02aba1d2ccc9623234849df49f3d3fbf90b4b4c180c8e7496d36ca341af39bf16c6cec9a735981906ed94949b21e192fdc200f92f22596f5740db3cb01404d71
7
- data.tar.gz: eea2c0cf468653aac44d138fb928292daaaab5fb9d296d1149e6cc28a3ab30a84b2afd7291e47a0ede5a5f5929b5f669a91bc21d5d19adafb7e10cdd6842f75e
6
+ metadata.gz: a2309375dd6555cc7ca361513a9147844611519ad5c19a765e24a018cab5725faa2d91e50ca7698080d2efa7dc526876096f0ff97f7c7984945ab8da517e7a48
7
+ data.tar.gz: 8ad79ffc90dae8461e019b18ad5371e94943df3e39d58697089a4a8510d856a1d0859b5b8792f0e4118f99715af106043db4e7ed1b96085794fa58b95f8da7c9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 2.0.0
2
+
3
+ * Add test matrix for Ruby versions 2.7.6, 3.0.4 and 3.1.2
4
+ * Update Publish Gem workflow to run manually
5
+ * Add support for configurable start heading size
6
+ * Add preprocessor for markdown files
7
+ * Add support for inset text component
8
+ * Add support for details component
9
+ * Add pry as developer dependency
10
+
1
11
  ## 1.0.0
2
12
 
3
13
  * Increase minimum supported Ruby version to >= 2.7.0
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- govuk_markdown (2.0.0)
4
+ govuk_markdown (2.0.1)
5
5
  activesupport
6
6
  redcarpet
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (6.1.4)
11
+ activesupport (6.1.7.3)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
@@ -16,22 +16,22 @@ GEM
16
16
  zeitwerk (~> 2.3)
17
17
  ast (2.4.2)
18
18
  coderay (1.1.3)
19
- concurrent-ruby (1.1.9)
19
+ concurrent-ruby (1.2.2)
20
20
  diff-lcs (1.4.4)
21
- i18n (1.8.10)
21
+ i18n (1.12.0)
22
22
  concurrent-ruby (~> 1.0)
23
23
  method_source (1.0.0)
24
- minitest (5.14.4)
24
+ minitest (5.18.0)
25
25
  parallel (1.20.1)
26
26
  parser (3.0.2.0)
27
27
  ast (~> 2.4.1)
28
28
  pry (0.14.1)
29
29
  coderay (~> 1.1)
30
30
  method_source (~> 1.0)
31
- rack (3.0.0)
31
+ rack (3.0.7)
32
32
  rainbow (3.0.0)
33
33
  rake (13.0.6)
34
- redcarpet (3.5.1)
34
+ redcarpet (3.6.0)
35
35
  regexp_parser (2.1.1)
36
36
  rexml (3.2.5)
37
37
  rspec (3.10.0)
@@ -74,10 +74,10 @@ GEM
74
74
  rubocop (~> 1.0)
75
75
  rubocop-ast (>= 1.1.0)
76
76
  ruby-progressbar (1.11.0)
77
- tzinfo (2.0.4)
77
+ tzinfo (2.0.6)
78
78
  concurrent-ruby (~> 1.0)
79
79
  unicode-display_width (2.0.0)
80
- zeitwerk (2.4.2)
80
+ zeitwerk (2.6.7)
81
81
 
82
82
  PLATFORMS
83
83
  ruby
data/README.md CHANGED
@@ -4,6 +4,8 @@ This Ruby gem converts Markdown into [GOV.UK Frontend](https://github.com/alphag
4
4
 
5
5
  Don't confuse this gem with [govspeak](https://github.com/alphagov/govspeak), which is a Markdown dialect specifically built for the GOV.UK publishing system (www.gov.uk).
6
6
 
7
+ Note that this gem supports [GOV.UK Components](https://github.com/DFE-Digital/govuk-components) version 4.0.0
8
+
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
@@ -14,6 +16,8 @@ gem 'govuk_markdown'
14
16
 
15
17
  ## Usage
16
18
 
19
+ ### Basic usage
20
+
17
21
  ```rb
18
22
  GovukMarkdown.render(markdown)
19
23
  ```
@@ -32,6 +36,48 @@ Will output:
32
36
  </p>
33
37
  ```
34
38
 
39
+ ### Editing the start heading size of headings
40
+
41
+ By default, H1 headings will be set to XL. You can override the start heading size, for example if you want to start with size L instead.
42
+
43
+ All subsequent headings i.e. H2, H3, will be sized correctly according to the start heading size.
44
+
45
+ Values can be "xl", "l", "m" and "s".
46
+
47
+ To specify the start heading size for your markdown content, add the below option into your GovukMarkdown.render() method:
48
+
49
+ ```ruby
50
+ GovukMarkdown.render(markdown, headings_start_with: "l")
51
+ ```
52
+
53
+ ### Adding inset text to your markdown
54
+
55
+ To add [inset text](https://govuk-components.netlify.app/components/inset-text/) to your markdown document, use the following tags:
56
+
57
+ ```markdown
58
+ {inset-text}Text to be inset goes here{/inset-text}
59
+ ```
60
+
61
+ The renderer also handles multi-line text as well as multiple paragraphs inside the tags:
62
+
63
+ ```markdown
64
+ {inset-text}
65
+ Text to be
66
+ inset goes
67
+ here
68
+ {/inset-text}
69
+ ```
70
+
71
+ ### Adding details sections to your markdown
72
+
73
+ To add the [details component](https://govuk-components.netlify.app/components/details/) to your markdown, use the following tags:
74
+
75
+ ```markdown
76
+ {details} Find out about the fox and the dog. Whilst the fox is quick and brown, the dog is lazy. {/details}
77
+ ```
78
+
79
+ The first sentence is rendered as the details summary text. The remaining text is rendered as the details text. The renderer handles multiple paragraphs for the details text.
80
+
35
81
  ## Development
36
82
 
37
83
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -40,15 +86,6 @@ To install this gem onto your local machine, run `bundle exec rake install`.
40
86
 
41
87
  You can regenerate the example HTML file from Markdown using `bundle exec rake generate_example`.
42
88
 
43
- ## Release a new version
44
-
45
- 1. Update the version in [lib/govuk_markdown/version.rb](lib/govuk_markdown/version.rb)
46
- 2. Run `bundle install`
47
- 3. Update [CHANGELOG.md](CHANGELOG.md)
48
- 4. Create a pull request
49
-
50
- When changes are merged into the `main` branch, a new version will be released using a GitHub action.
51
-
52
89
  ## Contributing
53
90
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/DfE-digital/govuk_markdown.
91
+ Bug reports and pull requests are welcome on GitHub at https://github.com/DfE-digital/govuk-markdown.
@@ -7,7 +7,7 @@ module GovukMarkdown
7
7
  end
8
8
 
9
9
  def inject_inset_text
10
- output.gsub!(build_regexp("inset-text")) do
10
+ @output = output.gsub(build_regexp("inset-text")) do
11
11
  <<~HTML
12
12
  <div class="govuk-inset-text">
13
13
  #{nested_markdown(Regexp.last_match(1))}
@@ -18,7 +18,7 @@ module GovukMarkdown
18
18
  end
19
19
 
20
20
  def inject_details
21
- output.gsub!(build_regexp("details")) do
21
+ @output = output.gsub(build_regexp("details")) do
22
22
  summary, details = *construct_details_from(Regexp.last_match(1))
23
23
 
24
24
  <<~HTML
@@ -1,3 +1,3 @@
1
1
  module GovukMarkdown
2
- VERSION = "2.0.0".freeze
2
+ VERSION = "2.0.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tijmen Brommet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-15 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport