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

Markdown that's passed as inner text to new link/image template hooks not rendering #6629

Closed
jakejarvis opened this issue Dec 18, 2019 · 3 comments · Fixed by #6632
Closed
Labels
Milestone

Comments

@jakejarvis
Copy link
Contributor

jakejarvis commented Dec 18, 2019

re: #6545 (comment)

I'm playing with the (awesome) new template hooks introduced in #6614 and #6545. I have links where the inner text includes code styling (via markdown, single tildes) but .Text in render-link.html returns plaintext like so:

<a href="{{ .Destination | safeURL }}" target="_blank" rel="noopener">{{ .Text }}</a>
[`should be code`](https://gohugo.io)

...returns <a href....>should be code</a> instead of <a href....><code>should be code</code></a> as v0.61.0 does.

Same with bold text ([**bold text**](https://gohugo.io)) and other markdown styling. I've tried {{ .Text | markdownify }} as well with the same result.

@bep bep added this to the v0.62 milestone Dec 18, 2019
bep added a commit to bep/hugo that referenced this issue Dec 18, 2019
bep added a commit to bep/hugo that referenced this issue Dec 18, 2019
bep added a commit to bep/hugo that referenced this issue Dec 18, 2019
@bep
Copy link
Member

bep commented Dec 18, 2019

OK, I have a working solution for this. I will discuss this with the Goldmark author to maybe get a cleaner solution in the API for the long term.

One question:

Since you can create hook templates per output format, I suggest that we keep the "plain text" as a separate attribute:

So:

  • Text is the rendered HTML
  • PlainText is the plain variant (what you now get)

Sounds good?

/cc @jakejarvis @regisphilibert

bep added a commit to bep/hugo that referenced this issue Dec 18, 2019
bep added a commit to bep/hugo that referenced this issue Dec 18, 2019
bep added a commit to bep/hugo that referenced this issue Dec 18, 2019
The context now have two text methods:

* Text - rendered
* PlainText

Fixes gohugoio#6629
@bep bep closed this as completed in #6632 Dec 18, 2019
bep added a commit that referenced this issue Dec 18, 2019
The context now have two text methods:

* Text - rendered
* PlainText

Fixes #6629
@jakejarvis
Copy link
Contributor Author

@bep looking great, thanks! :)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants