CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.89k stars 1.6k forks source link

The displayed title contains `#` #1004

Closed L-Super closed 5 months ago

L-Super commented 5 months ago

What happened?

The displayed title contains #, this is different from the previous display image

Hugo version

v0.124.1

Theme version

v3.25.0

What browsers are you seeing the problem on?

Microsoft Edge

More information about the browser

Windows11,Android

Relevant log output

No response

Link to Minimal Reproducible Example

https://demo.stack.jimmycai.com/p/markdown-syntax-guide/#paragraph

thangbuiq commented 5 months ago

+1 Is there any option to turn off the # before every heading? @CaiJimmy

matthews84 commented 5 months ago

+1 I have the same problem

chrjsrayman commented 5 months ago

This can be fixed by adding an overwrite to the template.

Create render-heading.html in layouts/_default/_markup/and add the following snippet:

<h{{ .Level }} id="{{ .Anchor }}">
    <a href="#{{ .Anchor }}">{{ .Text | safeHTML }}</a>
</h{{ .Level }}>

(Derived from the original feature commit: https://github.com/CaiJimmy/hugo-theme-stack/commit/539c39d69a150d0024cde275b9c91b5365fa4ee1)

CaiJimmy commented 5 months ago

Sorry for the late reply, I'll add an option to this feature when I have more time.

getvictor commented 5 months ago

By default, the # should only be visible on hover, like here: https://stack.jimmycai.com/config/image-processing#cover

CaiJimmy commented 5 months ago

Should be fixed now with #1016, heading anchor can be enabled with the article.headingAnchor parameter.