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

TOC doesn't contain <code> anymore (0.60) #6736

Closed
Jos512 opened this issue Jan 10, 2020 · 3 comments · Fixed by #6934
Closed

TOC doesn't contain <code> anymore (0.60) #6736

Jos512 opened this issue Jan 10, 2020 · 3 comments · Fixed by #6934
Labels
Milestone

Comments

@Jos512
Copy link

Jos512 commented Jan 10, 2020

What version of Hugo are you using (hugo version)?

Hugo Static Site Generator v0.62.2/extended windows/amd64 BuildDate: unknown
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.13.4"

Does this issue reproduce with the latest release?

Yes, it's actually a new issue.

I could not find in the release notes documented changes to TOC's <code> behaviour.

Before

Earlier, when our Markdown headings contained code, that code would appear as <code> in the TOC.

For example:

## Hugo's `where` function
Performs filtering.

## `.RenderString` is new

Renders the following HTML on Hugo 0.55.6:

<nav id="TableOfContents">
<ul>
<li>
<ul>
    <li><a href="#hugo-s-where-function">Hugo’s <code>where</code> function</a></li>
    <li><a href="#renderstring-is-new"><code>.RenderString</code> is new</a></li>
</ul>
</li>
</ul>
</nav>

Note the <code> around the words with a backtick.

Now

With Hugo 0.62.2, <code> doesn't appear in the TOC anymore. For example, the same Markdown now makes this TOC:

<nav id="TableOfContents">
<ul>
<li>
    <a href="#hugos-where-function">Hugo's where function</a></li>
    <li><a href="#renderstring-is-new">.RenderString is new</a></li>
</ul>
</nav>

Repository to replicate

See https://github.com/Jos512/hugo-toc-issue

@bep
Copy link
Member

bep commented Jan 10, 2020

Yes, it's actually a new issue.

So, in Hugo 0.61 it behaved differently?

@Jos512
Copy link
Author

Jos512 commented Jan 10, 2020

So, in Hugo 0.61 it behaved differently?

Sorry, I answered from my own perspective. 🤦‍♂️

To answer it properly, the 'issue' first happened in:

Hugo Static Site Generator v0.60.0/extended windows/amd64 BuildDate: unknown
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.13.4"

And the last good version was:

Hugo Static Site Generator v0.59.1/extended windows/amd64 BuildDate: unknown
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.13.1"

@Jos512 Jos512 changed the title TOC doesn't contain <code> anymore (0.62.2) TOC doesn't contain <code> anymore (0.60) Jan 10, 2020
satotake added a commit to satotake/hugo that referenced this issue Feb 22, 2020
Fixes gohugoio#6736
Fixes gohugoio#6809

Previously gordmark-based TOC renderes only `KindText` and `KindString`
This PR expands target node with goldmark's renderer

I am not sure of what are expected results as TOC contents in some (rare) cases
but Blackfriday's behaviours are fundamentally respected.
For example,
- image `[image text](link)` is rendered as `<img>` tag
- GFM AutoLink `gohugo.io` is rendered as text
@bep bep added this to the 0.65.3 milestone Feb 22, 2020
@bep bep closed this as completed in #6934 Feb 22, 2020
bep pushed a commit that referenced this issue Feb 22, 2020
Previously gordmark-based TOC renderes only `KindText` and `KindString`

This commit expands target node with Goldmark's renderer

I am not sure of what are expected results as TOC contents in some (rare) cases
but Blackfriday's behaviours are fundamentally respected.

For example,
- image `[image text](link)` is rendered as `<img>` tag
- GFM AutoLink `gohugo.io` is rendered as text

* Render AutoLink as <a> tag as Blackfriday does

Fixes #6736
Fixes #6809
@github-actions
Copy link

github-actions bot commented Feb 6, 2022

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 6, 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