zwbetz-gh / cupper-hugo-theme

An accessibility-friendly Hugo theme, ported from the original Cupper project.
https://cupper-hugo-theme.netlify.app/
MIT License
301 stars 190 forks source link

Table of Contents not working for non ASCII characters #5

Closed andradei closed 5 years ago

andradei commented 5 years ago

Describe the bug Table of Contents is rendered with href that won't point correctly to h2s in markdown content if characters like ã, ç, õ, é, etc. are used.

For example:

The markdown header

## Introdução

gets rendered with an a href="#introduc-a-o" but the table of contents points to <a href="#introduc%25CC%25A7a%25CC%2583o">Introdução</a>.

This has to do with the way the hrefs get generated in markdown and partials/toc.html being different.

While it works for ASCII characters, it doesn't for the rest.

To Reproduce Steps to reproduce the behavior:

  1. Create any .md post with ## Introdução, for example
  2. Turn on Table of Contents

Expected behavior The escaped URL for Nação be the same in the Table of Contents and the actual h2's a tag, so that the links can be followed from the Table of Contents

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

zwbetz-gh commented 5 years ago

Thanks for opening this issue @andradei. It has been fixed in 35ccaa2.