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

Generate explicit IDs for headings. #1641

Merged
merged 13 commits into from
Feb 7, 2019
Merged

Generate explicit IDs for headings. #1641

merged 13 commits into from
Feb 7, 2019

Conversation

tesseralis
Copy link
Member

@tesseralis tesseralis commented Feb 7, 2019

  • Add scripts/generateHeadingIDs to add headings to a directory.
  • Run this script on content/ on yarn check-all.
  • Update all current content files to add these IDs.

Resolves: #1608

@facebook-github-bot
Copy link
Collaborator

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@reactjs-bot
Copy link

reactjs-bot commented Feb 7, 2019

Deploy preview for reactjs ready!

Built with commit 25df15b

https://deploy-preview-1641--reactjs.netlify.com

@smikitky
Copy link
Member

smikitky commented Feb 7, 2019

There are some weird auto-generated IDs, like ## Khan Academy - Officially moving to React {#khan-academy---officially-moving-to-react}.

Instead of our own generateID, we should use github-slugger to generate IDs. It's already included as a dependency.

@tesseralis
Copy link
Member Author

Somehow, all of the --- generated are to spec:

https://reactjs.org/blog/2015/03/30/community-roundup-26.html#ray-wenderlich---property-finder

@tesseralis
Copy link
Member Author

Okay! I'll use github-slugger

@facebook-github-bot
Copy link
Collaborator

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@smikitky
Copy link
Member

smikitky commented Feb 7, 2019

Oh sorry!

Either way, github-slugger is safer. It can handle cases where there are two or more identical headings within a single article (e.g., The first ### Example becomes example, the second one becomes example-1)


#### Breaking Changes
#### Breaking Changes {#breaking-changes-1}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so github-slugger is working fine :)

@@ -11,56 +11,56 @@ redirect_from:

React is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on [facebook.com](https://www.facebook.com). We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and answers some questions that you may have.

### [Code of Conduct](https://code.facebook.com/codeofconduct)
### [Code of Conduct](https://code.facebook.com/codeofconduct) {#code-of-conducthttpscodefacebookcomcodeofconduct}
Copy link
Member

@smikitky smikitky Feb 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found an inconsistent behavior when a heading is also a link.

The correct slug is code-of-conduct: https://reactjs.org/docs/how-to-contribute.html

Maybe we can add a String.replace to strip links.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that though, should be fixed :)

@tesseralis
Copy link
Member Author

tesseralis commented Feb 7, 2019

@bvaughn could you look over this at some point? I'm hesitant to commit something so big without someone more used to this repo looking at it.

@tesseralis tesseralis merged commit aada3a3 into master Feb 7, 2019
@bvaughn
Copy link
Contributor

bvaughn commented Feb 9, 2019

Hey, sorry Nat. I'm traveling this weekend– from London to the East coast to visit family. Don't have a lot of bandwidth. I think merging it without waiting for a review from me was probably a good call.

@rickhanlonii rickhanlonii deleted the generate-ids branch April 29, 2024 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants