Coder Social home page Coder Social logo

Comments (9)

DannyBen avatar DannyBen commented on June 8, 2024 1

Thanks for reporting. I will look into it.

from madness.

DannyBen avatar DannyBen commented on June 8, 2024

I think it should work now in the edge version.
Can you verify it works for your case?

from madness.

adambartyzal avatar adambartyzal commented on June 8, 2024

I've build it from origin/fix/diacritics-in-ids branch (hopefully that's what i should have done) and now none of my links work. But I do see some change in the generated webpage.

<h2><a id='24-prava-plastov-krabiky-pro-elektroniku'></a>2.4. Úprava plastové krabičky pro elektroniku</h2>

has changed to:

<h2 id="2-4-prava-plastov-krabi-ky-pro-elektroniku">2.4. Úprava plastové krabičky pro elektroniku</h2>

It's Czech language if that helps.

from madness.

DannyBen avatar DannyBen commented on June 8, 2024

Well. Let's take a step back.

  1. As it turns out, the current (released) version is working as expected.
  2. IDs are added to headers automatically, with diacritics removed - this is done by RedCarpet, and not under my control.
  3. The <!-- TOC --> magic comment, adds the same type of slugs, with diacritics removed completely.
  4. So - in essence - the released version is working as expected.

I was using this markdown document to test:

<!-- TOC -->

## 2.4. Úprava plastové krabičky pro elektroniku

which resulted in this HTML:

<ul>
  <li><a href="#2-4-prava-plastov-krabi-ky-pro-elektroniku">2.4. Úprava plastové krabičky pro elektroniku</a></li>
</ul>
      
<h2 id="2-4-prava-plastov-krabi-ky-pro-elektroniku">2.4. Úprava plastové krabičky pro elektroniku</h2>

with identical IDs, as expected.


Now - I totally agree that the IDs should contain diacritics - especially if this is how GitHub does it.:

2.4. Úprava => 2-4-úprava   # good
2.4. Úprava => 2-4-prava    # bad

but, unless this is changed in RedCarpet, I don't think there is much I can do about it.
I have opened an issue: vmg/redcarpet#739

So to recap:

  1. If you were referring to the links generated by the <!-- TOC --> marker - they should work in the released version. If they are not, I need you to provide me with a minimal markdown text and/or filename to reproduce.
  2. If you are linking to header IDs manually - you will have to use the same IDs like the ones that are generated (i.e. with diacritic letters erased altogether).

As a side note - I see that filenames with diacritics are not currently supported.

from madness.

adambartyzal avatar adambartyzal commented on June 8, 2024

Thank you for looking into this and for escalating it.

from madness.

DannyBen avatar DannyBen commented on June 8, 2024

Version 1.2.0 is now released, with support for pandoc as an alternative markdown renderer. When using renderer: pandoc in .madness.yml settings, headers with diacritics should work properly in Table of Contents.

Note that this requires having pandoc installed, but it should be as simple as brew install pandoc or any other OS package manager (apt / apk etc).

If anyone can confirm this works, or report that it doesn't, it will be appreciated.

from madness.

xorguy avatar xorguy commented on June 8, 2024

Is the docker image updated with support for pandoc renderer?

from madness.

DannyBen avatar DannyBen commented on June 8, 2024

Yup.

RUN apk add --no-cache pandoc

from madness.

DannyBen avatar DannyBen commented on June 8, 2024

I also had to remove leading numbers and dots from Table of Contents links, since pandoc removes them from header IDs.

# pandoc removes leading numbers and dots from header slugs, we do the same
slug = slug.remove(/^[\d\-]+/) if config.renderer == 'pandoc'

When using pandoc, headers that look like ## 2.4 Hello World will get the id hello-world by pandoc, so the ToC does the same.

from madness.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.