Skip to content

Generate explicit IDs for headings. - #1641

Merged
tesseralis merged 13 commits into
masterfrom
generate-ids
Feb 7, 2019
Merged

tesseralis merged 13 commits into
masterfrom
generate-ids

Conversation

@tesseralis

@tesseralis tesseralis commented Feb 7, 2019 •

Copy link
Copy Markdown
Contributor
  • 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
Copy Markdown
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

reactjs-bot commented Feb 7, 2019 •

Copy link
Copy Markdown

@smikitky

smikitky commented Feb 7, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor Author

Okay! I'll use github-slugger

@facebook-github-bot

Copy link
Copy Markdown
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

smikitky commented Feb 7, 2019

Copy link
Copy Markdown
Member

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)

### React Tools {#react-tools}

#### Breaking Changes
#### Breaking Changes {#breaking-changes-1}

Copy link
Copy Markdown
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 :)

Comment thread content/docs/how-to-contribute.md Outdated
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}

@smikitky smikitky Feb 7, 2019 •

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor 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 :)

Comment thread scripts/generateHeadingIDs.js Resolved
Comment thread scripts/generateHeadingIDs.js Resolved
@tesseralis

tesseralis commented Feb 7, 2019 •

Copy link
Copy Markdown
Contributor Author

@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

bvaughn commented Feb 9, 2019

Copy link
Copy Markdown
Contributor

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