frontend icon indicating copy to clipboard operation
frontend copied to clipboard

refactor: replace KaTeX with MathML, temml and Fira Math font

Open elbotho opened this issue 9 months ago • 3 comments

Experiment. Demo: https://frontend-git-katex-to-mathml-serlo.vercel.app/community/298700/lerne-latex Current version: http://serlo.org/community/298700/lerne-latex

I would like to test this on serlo.org staging, ~but it needs a way import styles before releasing in the editor~

I just realized that MathML support is very good now across the main browsers.

Upsides:

  • very pretty sans serif font
  • less markup
  • less traffic
  • probably better performance
  • better for SEO
  • less custom stuff
  • mhchem should also work
  • a bit less bundle size (but still no lightweight)

Potential downsides:

Unfortuately copy/pasting from/to other software does not work in both approaches.

Todo: Test, discuss, ~add macros again~.

elbotho avatar Mar 28 '25 16:03 elbotho

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

Name Status Preview Updated (UTC)
frontend ✅ Ready (Inspect) Visit Preview May 13, 2025 0:08am

vercel[bot] avatar Mar 28 '25 16:03 vercel[bot]

📦 Next.js Bundle Analysis for @serlo/frontend

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 104.71 KB (🟢 -827 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Twenty-five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/[...slug] 107.67 KB (-7 B) 212.38 KB
/___bot_or_not 114.88 KB (-7 B) 219.59 KB
/___editor_preview 88.89 KB (🟢 -17 B) 193.6 KB
/___old_comments 97.25 KB (-9 B) 201.96 KB
/biologie 175.62 KB (-7 B) 280.34 KB
/chemie 175.62 KB (-7 B) 280.33 KB
/content-only/[...slug] 96.54 KB (-7 B) 201.26 KB
/discussions 93.79 KB (-9 B) 198.5 KB
/entity/create/[type]/[taxonomyId] 160.23 KB (-16 B) 264.95 KB
/entity/repository/add-revision/[...id] 159.89 KB (-16 B) 264.61 KB
/entity/repository/compare/[entity_id]/[revision_id] 111.45 KB (-7 B) 216.17 KB
/event/history 124.46 KB (-9 B) 229.17 KB
/event/history/[...slug] 125.44 KB (-9 B) 230.15 KB
/event/history/user/profile/[username] 127.82 KB (-9 B) 232.54 KB
/gleichungs-app 162.07 KB (-13 B) 266.79 KB
/informatik 175.63 KB (-7 B) 280.34 KB
/lerntipps 175.62 KB (-7 B) 280.33 KB
/license/detail/[id] 82.88 KB (-7 B) 187.59 KB
/mathe 175.62 KB (-7 B) 280.33 KB
/nachhaltigkeit 175.63 KB (-7 B) 280.34 KB
/page/create 159.9 KB (-16 B) 264.62 KB
/taxonomy/term/create/[parent_id]/[id] 159.61 KB (-16 B) 264.32 KB
/user/notifications 126.69 KB (-9 B) 231.41 KB
/user/profile/[username] 194.28 KB (-16 B) 299 KB
/user/settings 136.93 KB (🟢 -16 B) 241.64 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

github-actions[bot] avatar Mar 28 '25 16:03 github-actions[bot]

For using this in the editor npm package, I think we need a way to apply the styling there. Do you have any preferences how to do this?

LarsTheGlidingSquirrel avatar Apr 01 '25 08:04 LarsTheGlidingSquirrel

@LarsTheGlidingSquirrel sorry for moving the tailwind files in here, that makes the PR a lot less readable than it could be.

I did some more test and it looks find for serlo.org content so far. A bit smaller / compact in some places, but nothing obviously wrong I could find. Will merge to staging for testing and make a new editor version.

elbotho avatar May 13 '25 12:05 elbotho