GithubHelp home page GithubHelp logo

Comments (9)

duyanghao avatar duyanghao commented on May 23, 2024 5

@ekalinin same problem appears on my MacBook.

Hey @duyanghao! Thanks for report.

Could you provide an example? (What is the source README? What TOC did you get? What TOC did you expect?)

Q1: What is the source README?

## 这是一个例子

这是段落内容

Q2: What TOC did you get?

Table of Contents
=================

      * [这是一个例子](#\xE8\xBF\x99\xE6\x98\xAF\xE4\xB8\x80\xE4\xB8\xAA\xE4\xBE\x8B\xE5\xAD\x90)

Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)

Q3: What TOC did you expect?

Table of Contents
=================

      * [这是一个例子](#这是一个例子)

from github-markdown-toc.

ekalinin avatar ekalinin commented on May 23, 2024

Could you provide an example?

from github-markdown-toc.

counter2015 avatar counter2015 commented on May 23, 2024

@yangchongduo you can urlencode the chinese text as toc tag.
For example :

$  echo '标题' | tr -d '\n' | xxd -plain | sed 's/\(..\)/%\1/g'
%e6%a0%87%e9%a2%98

Then in markdown, your tag may be like this

* [标题](#%e6%a0%87%e9%a2%98)

from github-markdown-toc.

counter2015 avatar counter2015 commented on May 23, 2024

BTW, I just test Chinese title in my environment, it works fine without url encoding.

Maybe it's related to your environment ?

My enviroment: win10, typora

from github-markdown-toc.

alexmojaki avatar alexmojaki commented on May 23, 2024

Example of a TOC I tried generating that didn't work: https://github.com/flasgger/flasgger/blob/ba6ca6233611378704d490b1fa6045d5e803b150/README.zh.md

The TOC has weird encoding like this:

* [高度参与的贡献者](#\xE9\xAB\x98\xE5\xBA\xA6\xE5\x8F\x82\xE4\xB8\x8E\xE7\x9A\x84\xE8\xB4\xA1\xE7\x8C\xAE\xE8\x80\x85)

Clicking on it does nothing.

If I click the link icon next to a header, the anchor just contains the Chinese characters directly, no encoding.

I'm on Chrome on Ubuntu.

from github-markdown-toc.

duyanghao avatar duyanghao commented on May 23, 2024

@ekalinin same problem appears on my MacBook.

from github-markdown-toc.

ekalinin avatar ekalinin commented on May 23, 2024

@ekalinin same problem appears on my MacBook.

Hey @duyanghao! Thanks for report.

Could you provide an example? (What is the source README? What TOC did you get? What TOC did you expect?)

from github-markdown-toc.

zeitounator avatar zeitounator commented on May 23, 2024

Note: if you feel like the following is not related, please just let me know and I will create a separate and complete bug report.


Unless I missed something, the problem is now exactly the same with any title containing special chars in any language (accents, cedillas, tilde, etc....). And this used to work without problems in older versions. I have no idea when the problem was introduced. I don't have time now to have a look but I will follow this ticket and may dig into it if possible/needed.

The only info I can give right now: I generated a toc 3 month ago that was correct. In between I upgraded gh-md-toc at least twice and the generation on same tiltles this morning is broken.

Abridged example:

Titles in my file (this is in French, all my files are UTF-8):

# Aperçu
# Prérequis

Toc generated back then:

* [Aperçu](#aperçu)
* [Prérequis](#prérequis)

Toc generated today:

* [Aperçu](#aper\xC3\xA7u)
* [Prérequis](#pr\xC3\xA9requis)

Cheers.

from github-markdown-toc.

zeitounator avatar zeitounator commented on May 23, 2024

I was able to validate we all suffer from the same problem: utf-8 encoded chars in href returned from google makdown api call are not decoded anymore.

With a rapid empiric tests, I noticed that version 0.6.0 was working correctly and with git bisect, I was able to trace the problem down to commit 495dfb3 which is related to #104.

I'm currently looking at the part that was added to awk script to see how to fix it. I'll push a PR if I find a solution.

from github-markdown-toc.

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.