Create a mixin module from renderer class#42
Merged
peteryates merged 1 commit intoDFE-Digital:mainfrom Mar 26, 2026
Merged
Conversation
Move the method definitions in the Renderer class into a mixin that can be included into a subclass of `Redcardpet::Render::HTML`. This is useful when trying to customise an existing extension to Redcarpet, for instance markdown-rails.
peteryates
approved these changes
Mar 26, 2026
Member
peteryates
left a comment
There was a problem hiding this comment.
Looks great to me. Didn't realise Renderer::Mixin was a thing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First off, thanks for creating and sharing this awesome gem! On GOV.UK Forms we're using it in a couple of places, it's a big help.
In forms-product-page, we've been using it with the markdown-rails gem, which is nice and lightweight, but it's a little awkward and we had to rewrite a bit more code than we'd like to get it to work, and it's pretty brittle (see govuk-forms/forms-product-page#940 (comment)).
It would be great if govuk-markdown could be included as a mixin into a class, I think that would make it easier for us to use it with markdown-rails.
I've raised this PR as a moving the existing methods into a module seemed pretty straightfoward, happy to take on whatever feedback or suggestions you have.
Many thanks!