Skip to content

Create a mixin module from renderer class#42

Merged
peteryates merged 1 commit intoDFE-Digital:mainfrom
lfdebrux:add-mixin
Mar 26, 2026
Merged

Create a mixin module from renderer class#42
peteryates merged 1 commit intoDFE-Digital:mainfrom
lfdebrux:add-mixin

Conversation

@lfdebrux
Copy link
Copy Markdown
Contributor

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!

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.
Copy link
Copy Markdown
Member

@peteryates peteryates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. Didn't realise Renderer::Mixin was a thing.

@peteryates peteryates merged commit c787b54 into DFE-Digital:main Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants