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 · 2 comments · Fixed by #6632
Closed

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

jakejarvis opened this issue Dec 18, 2019 · 2 comments · Fixed by #6632
Milestone

Comments

@jakejarvis
Copy link
Contributor

@jakejarvis 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

This comment has been minimized.

Copy link
Member

@bep 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 bep removed the NeedsInvestigation label 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 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

This comment has been minimized.

Copy link
Contributor Author

@jakejarvis jakejarvis commented Dec 19, 2019

@bep looking great, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.