From 3203aa6745c637acbcfc234df3912ec651aca9e4 Mon Sep 17 00:00:00 2001 From: David Biddle Date: Tue, 7 Apr 2026 17:37:43 +0100 Subject: [PATCH 1/3] Comment out unused allowed_push_host config --- govuk-forms-markdown.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/govuk-forms-markdown.gemspec b/govuk-forms-markdown.gemspec index 4d0bb3d..373c698 100644 --- a/govuk-forms-markdown.gemspec +++ b/govuk-forms-markdown.gemspec @@ -14,7 +14,8 @@ Gem::Specification.new do |spec| spec.license = "MIT" spec.required_ruby_version = ">= 3.4.6" - spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" + # This configures which hosts you can publish to - but we're not publishing anywhere + # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://github.com/alphagov/govuk-forms-markdown" From 24e7d6f2cdba031e1b24f7a7526bcc3b443040a7 Mon Sep 17 00:00:00 2001 From: David Biddle Date: Tue, 7 Apr 2026 17:39:20 +0100 Subject: [PATCH 2/3] Add usage instructions --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ca99d6d..473f98b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,31 @@ If bundler is not being used to manage dependencies, install the gem by executin ## Usage -TODO: Write usage instructions here +The `render` method will return HTML when provided with a markdown string. + +```ruby +# Call the render method with the markdown you want to render +GovukFormsMarkdown.render(markdown) + +# You can configure it to disallow headings +GovukFormsMarkdown.render(markdown, allow_headings: false) + +# You can configure it if you're passing Welsh language markdown +GovukFormsMarkdown.render(markdown, locale: "cy") +``` + +The `validate` method will return HTML when provided with a markdown string. + +```ruby +# Call the validate method with the markdown you want to render +GovukFormsMarkdown.validate(markdown) + +# You can configure it to disallow headings +GovukFormsMarkdown.validate(markdown, allow_headings: false) + +# It will return a JSON object containing a list of errors: +{ errors: [:too_long, :unsupported_tags_used] } +``` ## Development From 689c5d772434d6d0d5fa8489763a5a99e63c37e2 Mon Sep 17 00:00:00 2001 From: David Biddle Date: Wed, 8 Apr 2026 09:37:36 +0100 Subject: [PATCH 3/3] Add installation instructions --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 473f98b..d55e28e 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,13 @@ This gem exists largely to handle a GOV.UK Forms service use case and is unlikel TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. -Install the gem and add to the application's Gemfile by executing: +Add the gem to your Gemfile: - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -If bundler is not being used to manage dependencies, install the gem by executing: +```ruby +gem "govuk-forms-markdown", require: "govuk_forms_markdown", github: "alphagov/govuk-forms-markdown", tag: "0.8.0" # Check the Github releases for the latest tag +``` - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG +Then run `bundle install`. ## Usage