Vandivier / ladderly-3

the home site for the ladderly ecosystem
https://ladderly.io
11 stars 8 forks source link

Added rehypePrettyCode for syntax highlighting. #233

Closed anishpokharel closed 1 month ago

anishpokharel commented 1 month ago

This adds syntax highlighting for markdown blog posts.

vercel[bot] commented 1 month ago

@anishpokharel is attempting to deploy a commit to the John Vandivier's projects Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 1 month ago

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

Name Status Preview Comments Updated (UTC)
ladderly-3 ❌ Failed (Inspect) May 18, 2024 10:43pm
Vandivier commented 1 month ago

@anishpokharel the approach looks good but there are a few items before ready to merge:

  1. extraneous dependency on shiki
  2. type error blocking build
  3. highlighting based on language: we would like to support at least python, typescript, javascript, and java

should we pass the language to the config object somehow or will it be auto-detected? on https://www.ladderly.io/blog/2024-04-20-hook-fundamentals we use typescript but on https://www.ladderly.io/blog/2024-01-23-leetcode-solutions we use python

i am happy to require language annotations on the markdown files if that solves it

Vandivier commented 1 month ago

looks like highlight.js will be nicer https://begin.com/blog/posts/2021-11-09-tale-of-the-tape-highlightjs-vs-shiki

anishpokharel commented 1 month ago

It does the highlighting and detects language from markdown file. Here is it doing it's thing in dev.

image

image

image

But the build fails, however, because of a type error.

anishpokharel commented 1 month ago

https://github.com/rehype-pretty/rehype-pretty-code/issues/117

anishpokharel commented 1 month ago
1. extraneous dependency on shiki

2. type error blocking build

3. highlighting based on language: we would like to support at least python, typescript, javascript, and java
  1. The dependency on shiki is needed.
  2. Updated dependency's version to fix the type error.
  3. Language is detected from markdown file.
Vandivier commented 1 month ago

closed in favor of #234