Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to generate stable heading id for non english languages by setting myst_fully_normalize_name_slug_func #1019

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Alexey-NM
Copy link

@Alexey-NM Alexey-NM commented Jan 27, 2025

They need stable heading id to make refrences to headers from external documentation (some_chapter.html#zagalovok).
Unfortunately If there are titles in a non english language it will have numeric id which can be changed in any time.
It is difficult to automate and it is unstable because such number can be changed at any time.

This merge request allows to generate stable ids by setting myst_fully_normalize_name_slug_func in config.py

myst_fully_normalize_name_slug_func = 'utils.fully_normalize_name_by_any_lang'
def fully_normalize_name_by_any_lang(str:str)->str:
    normalize_name = ' '.join(str.lower().split())
    tr_str = translit(normalize_name,"ru",reversed=True)
    result = _make_id(tr_str)
    return result

It generates an english name from other language. It allows to use static id.

See also: #968 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants