Skip to content

Commit

Permalink
Merge pull request #374 from alphagov/restore-example-headings
Browse files Browse the repository at this point in the history
Restore behaviour of headings being able to be rendered inside example boxes
  • Loading branch information
callumknights authored Dec 24, 2024
2 parents e71ee61 + 3509809 commit 6242ac9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 8.8.2

* Fix a bug where headings were no longer rendering inside example boxes ([#374](https://github.com/alphagov/govspeak/pull/374))

## 8.8.1

* Update dependencies
Expand Down
2 changes: 1 addition & 1 deletion lib/govspeak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def render_image(image)
extension("example", surrounded_by("$E")) do |body|
<<~BODY
<div class="example" markdown="1">
#{body.strip.gsub(/\A^\|/, "\n|").gsub(/\|$\Z/, "|\n")}
#{body.strip.gsub(/\A^\|/, "\n|").gsub(/\|$\Z/, "|\n")}
</div>
BODY
end
Expand Down
2 changes: 1 addition & 1 deletion lib/govspeak/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Govspeak
VERSION = "8.8.1".freeze
VERSION = "8.8.2".freeze
end
16 changes: 16 additions & 0 deletions test/govspeak_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,22 @@ class GovspeakTest < Minitest::Test
</div>)
end

test_given_govspeak "
$E
### A heading within an example
Some example content
$E" do
assert_html_output %(
<div class="example">
<h3 id="a-heading-within-an-example">A heading within an example</h3>
<p>Some example content</p>
</div>)
end

test_given_govspeak "
$LegislativeList
* 1. Item 1[^1] with an ACRONYM
Expand Down

0 comments on commit 6242ac9

Please sign in to comment.