-
Notifications
You must be signed in to change notification settings - Fork 268
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
Run more user-supplied text through markdownify #303
Merged
Merged
Conversation
This file contains 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
rootwork
changed the title
All text sourced from Markdown should be run through markdownify
Run all text sourced from Markdown through markdownify
May 16, 2022
Signed-off-by: Ivan Boothe <[email protected]>
Signed-off-by: Ivan Boothe <[email protected]>
Signed-off-by: Ivan Boothe <[email protected]>
Signed-off-by: Ivan Boothe <[email protected]>
Signed-off-by: Ivan Boothe <[email protected]>
Signed-off-by: Ivan Boothe <[email protected]>
rootwork
changed the title
Run all text sourced from Markdown through markdownify
Run more user-supplied text through markdownify
May 16, 2022
@rootwork, I will review this asap. Thanks! |
chipzoller
approved these changes
May 18, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good here, thank you!
Pending approval from @onweru |
onweru
approved these changes
May 19, 2022
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.
Background
I had an emdash in a post, and using
---
for it, which gets transformed into—
via Goldmark's Typographer extension iftypographer = true
is set inmarkup.toml
, wasn't working in the summary text even though it was working in the main content of the post.I realized it was because the summary text is not run through
markdownify
.Fix
This PR runs all text through
markdownify
when it is reasonable to do so. Apart from applying Typographer if it's enabled, having it run throughmarkdownify
also allows for standard Hugo formatting things, like putting content within backticks into<code>
tags. I updated a post in the example site with a summary set in order to test this.Aside:
markdownify
does not automatically includeemojify
, even ifenableEmoji
is turned on in config (unfortunately this setting is not exposed as a site variable; see gohugoio/hugo#9902), so if we wanted to support emojis in any of this text we'd have to turn it on everywhere.Changes
In addition to regular post content (including tables of contents), the site author's description was already being run through
markdownify
, so no changes there.The affected text includes:
With
<code>
tags now possible in elements like a title, I changed the style for it from an fixed size (15px) to a relative one (85%), which maintains the existing size in body text.This PR does not include these text items:
<title>
elementbecause then you might have those
<code>
tags in what is supposed to be plaintext.Screenshots (if applicable)
Before:
After (note syntax highlight and em-dash):
Checklist
Ensure you have checked off the following before submitting your PR.