timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.
https://tailwind-nextjs-starter-blog.vercel.app/
MIT License
8.9k stars 2.07k forks source link

feat: add `rehype-katex-notranslate` plugin for preventing symbols in formulas to be translated by browser translate-tools. #1049

Closed PrinOrange closed 3 weeks ago

PrinOrange commented 3 weeks ago

For example, we have the origin webpage, with formulas

53f10b1155fa56826911f2204fb9b3e

But if I want to translate them into another language(for example, Korean-language) with Chrome translating-tools, the irrelevant Latin character symbols in KaTeX formulas would also be recognized and translated by mistake, and it would breaks the article layouts.

image

So I use the plugin rehype-katex-notranslate, which could tell apart symbols from formulas and sentences and add translate="no" property for formula blocks, so as to prevent formula symbols to be wrongly translated.

After effect:

b89deb0d4f2f01074e2dc85ea878b6e

vercel[bot] commented 3 weeks ago

@PrinOrange is attempting to deploy a commit to the timlrx's projects Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 3 weeks ago

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

Name Status Preview Comments Updated (UTC)
tailwind-nextjs-starter-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2024 8:55am
timlrx commented 3 weeks ago

Fix looks good to me, thanks.