-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Support explicit heading IDs [Fixes #272] #369
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@samajammin may need comprehensive review from the community of the multi-language documents, since this change involves impacts the heading anchors of all the languages. |
@samajammin could you please also review this PR? I has also been pending for 4~5 days |
@think-in-universe excellent work here! This review will take some time but I'll try to wrap it up tomorrow. I have a question on your script (scripts/generateHeadingIDs.js). You described the purpose is:
Could you please explain this in a bit more depth? At a quick look through, it appears it gathers the header IDs of the English files into a Here's the output from pulling down this PR w/ a fresh yarn install & running After removing a few header IDs (e.g. from /docs/de/developers/index.md) & re-running the script, nothing changed with any files. I expected those missing headers to be added. Here's the output: Please let me know if I'm misunderstanding or if there is in fact a bug. |
@samajammin this is a good question. There're several comments worth mentioning:
The below steps describe how this script works in generally:
A bit more comments about improving the script:
|
Super helpful explanation! Thank you. Regarding your point here:
As you pointed out, this is a risky assumption. While our goal is to have the translated pages share the same content (& header structure) as the English version, this will not consistently be the case. We expect the translations to lag behind the English versions (such as the missing As to your last point:
I think that's fair. Given that the header structure of translated file is not guaranteed to match the corresponding English header structure, it would be difficult to solve this programmatically. I believe a simpler script that would be consistently useful for this translation process is a script that, when given a filename, iterates through all headers of the file & generates explicit header IDs if they don't yet exist. An example use case I'm thinking of here is when we want to translate the /docs/enterprise/index.md page (ethereum.org/enterprise). We'll want the English page to have those explicit IDs so that the translated files also have them (when new English files are added to CrowdIn, they begin as copies of the English page). So e.g. by running:
This script isn't a specific requirement of the bounty & therefore is not necessary but we'd welcome the contribution 😄 Thanks again for this submission! Excellent work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, really great work here. Thanks @think-in-universe!
Reviewing the h3 (###
) header IDs in all the translated developers
pages, they definitely don't match up but I think that's ok for now since we don't display the same sidebar depth for our translated content, so there's nothing that links to those headers. So don't feel the need to fix these.
One aspect that does need to be fixed is the references to the old header IDs. E.g. in /docs/de/use/index.md:
<div class="featured">
**Willst du mit Ethereum loslegen?** Diese Seite gibt dir die grundlegenden Informationen, die du brauchst.
1. [Eine auf Ethereum basierende Anwendung verwenden](#_1-eine-auf-ethereum-basierende-anwendung-verwenden)
2. [Was ist ETH, und wie bekomme ich es?](#_2-was-ist-eth-und-wie-bekomme-ich-es)
3. [Was ist eine Wallet, und welche sollte ich verwenden?](#_3-was-is-a-wallet-and-which-one-should-i-use)
</div>
Those anchor links should be updated to their English version, as specified in the issue. You can see in the preview that they no longer work.
Once those outlier links are updated, this PR will be good to go!
|
||
Ethereum verfügt über eine große und wachsende Anzahl von Tools, um Programmierern beim Entwickeln, Testen und Bereitstellen von Anwendungen zu helfen. Nachfolgend sind die beliebtesten Tools aufgeführt, mit denen du direkt loslegen kannst. Wenn du tiefer eintauchen möchtest, schau dir diese [umfassende Liste](https://github.com/ConsenSys/ethereum-developer-tools-list) an. | ||
|
||
### Truffle: *Entwicklungsumgebung, Test-Framework, Build-Pipeline und weitere Tools* | ||
### Truffle: *Entwicklungsumgebung, Test-Framework, Build-Pipeline und weitere Tools* {#frameworks} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like these h3's match up 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. We could either remove all the h3 heading IDs in non-English versions, or make changes later.
@samajammin sounds good. I think that's a quick win, and I have updated the script so you'll be able to run the script against a folder, e.g. yarn run generate-heading-ids docs/enterprise and the custom heading IDs of the markdown files under that folder will be added. The log is added in the gist: https://gist.github.com/think-in-universe/a979a3d12e97b3949ac72e78c4462587 I didn't commit the update to |
@samajammin the anchor links to the English version should have been fixed now. https://deploy-preview-369--ethereumorg.netlify.com/de/use/ I modified |
ToDos:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for updating those /use links & the script.
Description
Update the application to support consistent anchor links across languages.
Tasks:
Meet Submission Requirements:
## Heading {#head1}
, which should be quite easy to follow by translators.Related Issue
Resolves: #272
Screenshots:
As shown below, the same heading anchor is applied for all the languages:
developers/#best-practices-patterns-and-anti-patterns
English:
Deutsch:
Chinese:
And the illustrated problem described in the submission requirement is already resolved:
Checklist: