Feature: Added tab to display README from GitHub repo #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added a tab that loads the
readme.md
file from GitHub through the Octokit API (lib/actiona/get-readme.ts
).I pass load that into a component name
Readme
incomponents/projects/project-readme.tsx
that uses thereact-markdown
package. I imported the same plugins using #3 as a referenceFor the code block syntax highlighting I used Shiki v1.3.0 with the 'github-light' theme. I do the actual syntax highlighting in a server action (
lib/actions/code-to-html.ts
) instead of as a plugin toreact-markdown
which makes it very easy to use and customize.For the markdown components, I implemented most of them directly in
components/projects/project-readme.tsx
to keep the imports minimal since most of them are simple. However, I did implementCode
incomponents/md/Code.tsx
since it is a bit more complex and requires hooks to perform a call thecodeToHtml
server action.I checked my markdown implementation using a complete markdown example.
I kept the styling very minimal, but feel free to let me know how you would like them to look and I can add to the styles.
Here are screenshots of the results of that so that you can see what it looked like.









