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 READMEs fetched from GitHub #2

Merged
merged 4 commits into from
May 21, 2022
Merged

Fix READMEs fetched from GitHub #2

merged 4 commits into from
May 21, 2022

Conversation

delucis
Copy link
Collaborator

@delucis delucis commented May 21, 2022

The previous technique for fetching GitHub READMEs was a bit broken because it relied on the repo’s default branch being main, which turned out not to always be the case.

This PR uses the GitHub REST API to fetch the READMEs instead. This requires a GitHub Access Token to be added to the build environment variables as PUBLIC_GITHUB_TOKEN, but is a much more reliable way to get the content.

Once I’d done that, I realised a bunch more rendering limitations with just plonking the raw Markdown from GitHub on a page: broken images & links and rendering anomalies. So I’ve built a remark pipeline to try to quickly emulate GitHub’s rendering and fix the images and links. It’s a bit like npm’s marky-markdown, but that doesn’t seem to be compatible with modern projects.

delucis added 2 commits May 21, 2022 22:40
The previous technique for fetching GitHub READMEs was a bit broken because it relied on the repo’s default branch being `main`, which turned out not to always be the case.

This commit uses the GitHub REST API to fetch the READMEs instead. This requires a GitHub Access Token to be added to the build environment variables as `PUBLIC_GITHUB_TOKEN`, but is a much more reliable way to get the content.

Once I’d done that, I realised a bunch more rendering limitations with just plonking the raw Markdown from GitHub on a page: broken images & links and rendering anomalies. So I’ve built a remark pipeline to try to quickly emulate GitHub’s rendering and fix the images and links. It’s a bit like npm’s `marky-markdown`, but that doesn’t seem to be compatible with modern projects.
Agnostic UI linked to a package in the monorepo, so we need to handle that, not just top-level repo URLs
@vercel
Copy link

vercel bot commented May 21, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
hackathon-1-0-projects ✅ Ready (Inspect) Visit Preview May 21, 2022 at 10:58PM (UTC)

Copy link
Member

@aFuzzyBear aFuzzyBear left a comment

Choose a reason for hiding this comment

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

💚💚💚
Out-fricken-standing
👏👏👏

@aFuzzyBear aFuzzyBear merged commit 9f60682 into astro-community:main May 21, 2022
@delucis delucis deleted the delucis/fix-readmes branch May 21, 2022 23:48
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.

2 participants