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

Fix the links for non-English alphabets when anchors generated #2028

Merged
4 commits merged into from Feb 3, 2019
Merged

Fix the links for non-English alphabets when anchors generated #2028

4 commits merged into from Feb 3, 2019

Conversation

ghost
Copy link

@ghost ghost commented Feb 3, 2019

Consider that some special characters (not included in the 26 English alphabets) are ignored by md file's anchor when generated. We have to change the anchor link.

Take this as an example:'SmartOS 和 illumos', the '和' doesn't belong to an English character, so it's ignored and the generated anchor would be '#smartos-illumos' instead of '#smartos-and-illumos'.

This is the HOT fix for that. What I did now is to use the pure HTML instead of md's "##" to force the "a href"'s link to keep it the same as that in English version.

PS:For Japanese, it seems they've noticed the anchor problem so their anchor name isn't the same as the English version. What I do is just to change the title to make it the same as what we can see in the category.

【Before Fix】
image

@ghost ghost requested a review from ZYSzys February 3, 2019 02:51
@ghost
Copy link
Author

ghost commented Feb 3, 2019

@nodejs/nodejs-cn:Please have a review for that.

@ghost ghost requested a review from fhemberger February 3, 2019 02:54
@ghost ghost changed the title Fix: Fix the links for non-English alphabets when anchors generated zh-CN:Fix the links for non-English alphabets when anchors generated Feb 3, 2019
Consider that some special characters (not included in the 26 English
alphabets) are ignored by md file's anchor when generated. We have to
change the anchor link.

Take this as an example:'SmartOS 和 illumos', the '和' doesn't belong
to an English character, so it's ignored and the generated anchor would
be '#smartos-illumos' instead of '#smartos-and-illumos'.

This is the HOT fix for that. What I did now is to use the pure HTML
instead of md's "##" to force the "a href"'s link to keep it the same
as that in English version.
@ghost
Copy link
Author

ghost commented Feb 3, 2019

@nodejs/localization:Kindly tip, please notice whether your own specific language has the same problem :)

@ghost ghost changed the title zh-CN:Fix the links for non-English alphabets when anchors generated Fix the links for non-English alphabets when anchors generated Feb 3, 2019
@ghost ghost merged this pull request into nodejs:master Feb 3, 2019
@ghost ghost deleted the FixAnchorErr branch February 3, 2019 08:45
@yous
Copy link
Contributor

yous commented Feb 3, 2019

Did these commits disappear from master? The commits of #2026 are also gone.

@yous
Copy link
Contributor

yous commented Feb 3, 2019

I don't see the images, they only show [cid:...]. Can you re-post them on GitHub?

ghost pushed a commit that referenced this pull request Feb 3, 2019
Because of the missing submission, we have to re-submit them together.

Ref 1: #2028,
Ref 2: #2026.
@ghost
Copy link
Author

ghost commented Feb 3, 2019

@yous:No problem, I've re-submitted and everything goes fine !

@ghost ghost mentioned this pull request Feb 7, 2019
ghost pushed a commit that referenced this pull request Feb 7, 2019
The Non-English characters WON'T be generated in the anchor link, so this is the HOT fixture for that.

Ref: #2028.
fhemberger pushed a commit that referenced this pull request Feb 9, 2019
* Fix: Fix for the non-English character generation of Anchor Link

I. In the recent days we've fixed the non-English character generation
of anchor link by directly using the pure HTML tags, however a better
way is:

1) Check whether the current title has the comment symbol (<!---->).
2) If yes, just take the characters out of the symbol as the anchor
link's name, with the real text as the title behind it.
3) If not, just do replacements as what it used to be.

The advantage is that you can keep the anchor link the same as what
it is in the English version or define by yourself. What's more: It's
much more flexible when your change the level of titles, compared with
#2028.

II. Add '--fix' for local test to automatically fix some simple
formation typo errors.

* fix_comment
This pull request was closed.
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.

1 participant