Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable hard_wrap in kramdown-parser-gfm #518

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

chrisroos
Copy link
Member

The hard_wrap option is set to true by default which results in newlines within paragraphs being rendered as <br/> in HTML. This was causing a number of our pages (e.g. week-826) to be rendered differently since switching from the default kramdown renderer to the GFM renderer in 2444225.

I used the rake spec:regression:artefacts task to compare the rendered site with and without this option, and with the default kramdown renderer and I'm happy that the behaviour in this commit is closer to what we had originally. The only obvious change I can now see between the default kramdown renderer and the GFM renderer is that some automatically generated heading IDs are different but I'm happy to live with that.

The screenshots below show the difference in setting the hard_wrap option:

With hard_wrap set to true

Screenshot 2025-03-14 at 12-35-37 Week 826 — Go Free Range

With hard_wrap set to false

Screenshot 2025-03-14 at 12-35-44 Week 826 — Go Free Range

The `hard_wrap` option is set to true by default[1] which results in
newlines within paragraphs being rendered as `<br/>` in HTML. This was
causing a number of our pages (e.g. week-826) to be rendered differently
since switching from the default kramdown renderer to the GFM renderer
in 2444225.

I used the `rake spec:regression:artefacts` task to compare the rendered
site with and without this option, and with the default kramdown
renderer and I'm happy that the behaviour in this commit is closer to
what we had originally. The only obvious change I can now see between
the default kramdown renderer and the GFM renderer is that some
automatically generated heading IDs are different but I'm happy to live
with that.

[1]: https://github.com/kramdown/parser-gfm?tab=readme-ov-file
@chrisroos chrisroos merged commit 09c33b0 into main Mar 14, 2025
1 check passed
@chrisroos chrisroos deleted the disable-hard-wrap-in-kramdown-parser-gfm branch March 14, 2025 12:47
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.

1 participant