From 7550cc8fadbd1382341bb779f88529667ee92658 Mon Sep 17 00:00:00 2001 From: ChrisBAshton Date: Tue, 27 Jan 2026 14:49:50 +0000 Subject: [PATCH 1/2] Drop support for the `[embed:link:]` syntax This was [added in 2016](https://github.com/alphagov/govspeak/pull/83C) but doesn't appear to ever have been used. [Recent analysis in Whitehall](https://docs.google.com/spreadsheets/d/1ps58qqD0zgbWR-H0K6jmWJM-KhYBl6JApi5ZawOxmeU/edit?pli=1&gid=0#gid=0) shows zero usage in the wild. A re-run of the analysis also shows zero matched documents in Whitehall, through running: ``` rake 'reporting:matching_docs[embed:link]' ``` (as per https://docs.publishing.service.gov.uk/manual/find-usage-of-govspeak-in-content.html) Given the feature was allegedly brought into govspeak to retain feature parity with Whitehall (according to the changelog entry for v4.0.0), the absence of the syntax from any Whitehall content should give us reasonable confidence that the feature is not in use anywhere. Therefore we are removing this feature as it is unnecessary. --- README.md | 24 ----------------- lib/govspeak.rb | 11 -------- test/govspeak_link_test.rb | 54 -------------------------------------- 3 files changed, 89 deletions(-) delete mode 100644 test/govspeak_link_test.rb diff --git a/README.md b/README.md index bfa193cb..813b4858 100644 --- a/README.md +++ b/README.md @@ -568,30 +568,6 @@ will output a image section ``` -### Link - -Links to different documents can be embedded so they change when the documents -they reference change. - - A link to [embed:link:c636b433-1e5c-46d4-96b0-b5a168fac26c] - -with options provided - - { - links: [ - { - url: "http://example.com", - title: "An excellent website", - } - ] - } - -will output - -```html -

A link to An excellent website

-``` - ### Contact [Contact:df62690f-34a0-4840-a7fa-4ef5acc18666] diff --git a/lib/govspeak.rb b/lib/govspeak.rb index 0c6339dc..3f72b958 100644 --- a/lib/govspeak.rb +++ b/lib/govspeak.rb @@ -382,17 +382,6 @@ def render_image(image) end end - extension("embed link", /\[embed:link:\s*(.*?)\s*\]/) do |content_id| - link = links.detect { |l| l[:content_id] == content_id } - next "" unless link - - if link[:url] - "[#{link[:title]}](#{link[:url]})" - else - link[:title] - end - end - extension("Contact", /\[Contact:\s*(.*?)\s*\]/) do |content_id| contact = contacts.detect { |c| c[:content_id] == content_id } next "" unless contact diff --git a/test/govspeak_link_test.rb b/test/govspeak_link_test.rb deleted file mode 100644 index 31dac6a0..00000000 --- a/test/govspeak_link_test.rb +++ /dev/null @@ -1,54 +0,0 @@ -require "test_helper" - -class GovspeakLinkTest < Minitest::Test - test "embedded link with link provided" do - link = { - content_id: "5572fee5-f38f-4641-8ffa-64fed9230ad4", - url: "https://www.gov.uk/example", - title: "Example page", - } - govspeak = "[embed:link:5572fee5-f38f-4641-8ffa-64fed9230ad4]" - rendered = Govspeak::Document.new(govspeak, links: link).to_html - expected = %r{Example page} - assert_match(expected, rendered) - end - - test "embedded link with markdown title" do - link = { - content_id: "5572fee5-f38f-4641-8ffa-64fed9230ad4", - url: "https://www.gov.uk/example", - title: "**Example page**", - } - govspeak = "[embed:link:5572fee5-f38f-4641-8ffa-64fed9230ad4]" - rendered = Govspeak::Document.new(govspeak, links: link).to_html - expected = %r{Example page} - assert_match(expected, rendered) - end - - test "embedded link with external url" do - link = { - content_id: "5572fee5-f38f-4641-8ffa-64fed9230ad4", - url: "https://www.example.com/", - title: "Example website", - } - govspeak = "[embed:link:5572fee5-f38f-4641-8ffa-64fed9230ad4]" - rendered = Govspeak::Document.new(govspeak, links: link).to_html - expected = %r{Example website} - assert_match(expected, rendered) - end - test "embedded link with url not provided" do - link = { - content_id: "e510f1c1-4862-4333-889c-8d3acd443fbf", - title: "Example website", - } - govspeak = "[embed:link:e510f1c1-4862-4333-889c-8d3acd443fbf]" - rendered = Govspeak::Document.new(govspeak, links: link).to_html - assert_match("Example website", rendered) - end - - test "embedded link without link object" do - govspeak = "[embed:link:0726637c-8c66-47ad-834a-d815cbf51e0e]" - rendered = Govspeak::Document.new(govspeak).to_html - assert_match("", rendered) - end -end From 6cdd709de2cb23c846643e01c4fce83bafff606f Mon Sep 17 00:00:00 2001 From: ChrisBAshton Date: Tue, 27 Jan 2026 14:54:55 +0000 Subject: [PATCH 2/2] Bump to version 10.9.0 Technically a breaking change, but given the due diligence applied in the previous commit, this shouldn't break things for anybody. It seems overkill to go for a major version increase as a result. So, minor bump here (a patch, conversely, feels too small). --- CHANGELOG.md | 5 +++++ lib/govspeak/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81f7ce04..f677eca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 10.9.0 + +* BREAKING: drops support for `embed:link` syntax +* Not a major version change as we don't see any usages of the syntax in the wild + ## 10.8.5 * Update dependencies diff --git a/lib/govspeak/version.rb b/lib/govspeak/version.rb index 2c298f2c..e0cf3490 100644 --- a/lib/govspeak/version.rb +++ b/lib/govspeak/version.rb @@ -1,3 +1,3 @@ module Govspeak - VERSION = "10.8.5".freeze + VERSION = "10.9.0".freeze end