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

feat: React.dev docs #2375

Merged
merged 23 commits into from
Dec 12, 2024
Merged

feat: React.dev docs #2375

merged 23 commits into from
Dec 12, 2024

Conversation

gombosg
Copy link
Contributor

@gombosg gombosg commented Dec 1, 2024

Fixes #1997.
Test with: bundle exec thor docs:generate react
TODOs:

  • Basic scraper
  • Sanitize titles
  • Add categories
  • Fix code examples
  • Remove some more extra styling divs
  • Syntax highlighting
  • Update icon
  • Add "Learn" section
  • Strip styling classes
  • Address category main pages (1 level breadcrumb)
  • Fix loading <figure> images (base64 is wrong)
  • Prefix with category group (e.g. RSC, react-dom etc.)
  • Fix callouts (canary, you will learn, pitfalls)
  • Fix "show more" expansions
  • Transform recipe links to outgoing links (those example tabs can't be rendered properly, they need JS) - we can live with it in the first release
  • Add more search entries - we won't need them IMO

If you’re adding a new scraper, please ensure that you have:

  • Tested the scraper on a local copy of DevDocs
  • Ensured that the docs are styled similarly to other docs on DevDocs
  • Added these files to the public/icons/your_scraper_name/ directory:
    • 16.png: a 16×16 pixel icon for the doc
    • [email protected]: a 32×32 pixel icon for the doc
    • SOURCE: A text file containing the URL to the page the image can be found on or the URL of the original image itself

If you're updating existing documentation to its latest version, please ensure that you have:

  • Updated the versions and releases in the scraper file
  • Ensured the license is up-to-date
  • Ensured the icons and the SOURCE file in public/icons/your_scraper_name/ are up-to-date if the documentation has a custom icon
  • Ensured self.links contains up-to-date urls if self.links is defined
  • Tested the changes locally to ensure:
    • The scraper still works without errors
    • The scraped documentation still looks consistent with the rest of DevDocs
    • The categorization of entries is still good

@gombosg
Copy link
Contributor Author

gombosg commented Dec 2, 2024

Some fixes are still pending but it's looking good already!
Draft comments are welcome in the meantime, @simon04! 🥰

The only real problem I'm facing is that some figures are not displaying well in the Learn pages. The PNG seems to be transformed to Base64 with a wrong value.
image
image

@gombosg
Copy link
Contributor Author

gombosg commented Dec 8, 2024

@simon04 WDYT about the PR's direction? I'm happy to finish it in the coming days.

@simon04
Copy link
Contributor

simon04 commented Dec 8, 2024

Hi @gombosg, thank you for this great work – I love it! Please go ahead and let me know when/where I should help out.

Regarding the broken images, simply remove the srcset attribute – css('img').remove_attr('srcset')

@gombosg
Copy link
Contributor Author

gombosg commented Dec 11, 2024

It's ready for review @simon04! It looks good, as per my quality standards. 🤓

  • In the end I left the recipe/challenges etc. blocks as is. They either don't appear or appear okay. The user can always alt-o to the original docs. We can improve this in further PRs.
  • I left out additional search entries, they seemed to be too distracting, so we only have pages which correspond to items in the left sidebar.
  • $qq do we support hidden search entries that are searchable but don't appear in the left sidebar?
  • The page ships both light and dark images. I stripped dark ones but with some CSS media queries we could actually use both in DevDocs as well. This is another future improvement.

Note: React 19 has just been released. We could add it before merging, or we can merge that in a subsequent PR. I'd opt for the latter if possible, as it's more incremental that way.

@gombosg gombosg marked this pull request as ready for review December 11, 2024 00:12
@gombosg gombosg requested a review from a team as a code owner December 11, 2024 00:12
@gombosg gombosg changed the title React.dev docs (WIP) feat: React.dev docs Dec 11, 2024
Copy link
Contributor

@simon04 simon04 left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@simon04 simon04 merged commit 78f1c87 into freeCodeCamp:main Dec 12, 2024
2 checks passed
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.

React documentation is from the old website
2 participants