Kalan's Blog

Kalan 頭像照片,在淡水拍攝,淺藍背景

四零二曜日電子報上線啦!訂閱訂起來

Software Engineer / Taiwanese / Life in Fukuoka
This blog supports RSS feed (all content), you can click RSS icon or setup through third-party service. If there are special styles such as code syntax in the technical article, it is still recommended to browse to the original website for the best experience.

Current Theme light

我會把一些不成文的筆記或是最近的生活雜感放在短筆記,如果有興趣的話可以來看看唷!

Please notice that currenly most of posts are translated by AI automatically and might contain lots of confusion. I'll gradually translate the post ASAP

Change from prismjs to shiki

shiki is a package that provides syntax highlighting for code. It is relatively new and less well-known compared to other packages like highlightjs and prismjs. shiki uses TextMate grammar as its tokenizer definition, which makes it easy to extend with a unified standard without the need for custom language development.

Additionally, it has a wide range of supported languages and is easy to configure. It also offers many built-in themes, so I replaced prismjs with it. Install gatsby-remark-shiki and apply the settings, and you're good to go!

Encountered some minor issues:

  • React's highlight was originally used, but it needs to be changed to jsx or tsx.
  • If using c++, it needs to be changed to cpp.

Let's see the result:

const Component = () => <MyComponent />

Prev

tmux Shortcut Key Notes

Next

Several use cases of useMemo

If you found this article helpful, please consider buy me a drink ☕️ It'll make my ordinary day shine✨

Buy me a coffee