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

Replace .Text with .PlainText #13227

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Replace .Text with .PlainText #13227

wants to merge 1 commit into from

Conversation

Arty2
Copy link

@Arty2 Arty2 commented Jan 7, 2025

Replace .Text with .PlainText in alt to conform with the CommonMark specification: “Only the plain string content is rendered, without formatting.”

Replace .Text with .PlainText in alt to conform with the CommonMark specification: “Only the plain string content is rendered, without formatting.”
@CLAassistant
Copy link

CLAassistant commented Jan 7, 2025

CLA assistant check
All committers have signed the CLA.

@jmooring
Copy link
Member

jmooring commented Jan 8, 2025

You have a failing test that you can correct with this change:

diff --git a/hugolib/content_render_hooks_test.go b/hugolib/content_render_hooks_test.go
index 7f2c35032..a06dda3b2 100644
--- a/hugolib/content_render_hooks_test.go
+++ b/hugolib/content_render_hooks_test.go
@@ -279,7 +279,7 @@ Image: ![alt-"<>&](/destination-"<> 'title-"<>&')
                        if enabled {
                                b.AssertFileContent("public/index.html",
                                        "Link: <a href=\"/destination-%22%3C%3E\" title=\"title-&#34;&lt;&gt;&amp;\">text-&quot;&lt;&gt;&amp;</a>",
-                                       "img src=\"/destination-%22%3C%3E\" alt=\"alt-&quot;&lt;&gt;&amp;\" title=\"title-&#34;&lt;&gt;&amp;\">",
+                                       "img src=\"/destination-%22%3C%3E\" alt=\"alt-&#34;&lt;&gt;&amp;\" title=\"title-&#34;&lt;&gt;&amp;\">",
                                        "&gt;&lt;script&gt;",
                                )
                        } else {

Then test locally with go test ./....

Finally, change the commit message to adhere to these guidelines.
https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#git-commit-message-guidelines.

Something like:

tpl/tplimpl: Use PlainText for alt tag in image render hook

@bep bep added this to the v0.141.0 milestone Jan 8, 2025
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.

4 participants