gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 274 forks source link

auto_ids i18n: Non ASCII accents to ASCII #790

Closed 3ynm closed 1 year ago

3ynm commented 1 year ago

At present, the utilization of auto_ids while writing headers with accented characters results in their removal rather than their conversion to the ASCII version. This patch solves the issue for various languages.

Example:

# Hello

Results in id hello.

# Déjà vu

Results in id dj-vu.

With the patch it would result in id deja-vu.

gettalong commented 1 year ago

This is already done by the transliterated_header_ids option:

$ kramdown
# Déjà vu

# Hello
^d
<h1 id="dj-vu">Déjà vu</h1>

<h1 id="hello">Hello</h1>
$ kramdown --transliterated-header-ids
# Déjà vu

# Hello
^d
<h1 id="deja-vu">Déjà vu</h1>

<h1 id="hello">Hello</h1>
3ynm commented 1 year ago

@gettalong nice! though my solution doesn't require external dependencies... maybe I could improve that?

gettalong commented 1 year ago

@hacktivista I'm not sure this would be equivalent, see for example:

$ kramdown --transliterated-header-ids
# Зарегистрируйтесь сейчас
^d
<h1 id="zarieghistriruities-sieichas">Зарегистрируйтесь сейчас</h1>
3ynm commented 1 year ago

I see, that is way more compatible.