go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.97k stars 5.39k forks source link

Add KaTeX rendering for Org-mode files #21630

Open tecosaur opened 1 year ago

tecosaur commented 1 year ago

Feature Description

Now that KaTeX rendering for Markdown has been merged, it would be nice to extend that to Org documents too.

I've made a quick test/about document on try.gitea: https://try.gitea.io/tecosaur/testing/src/branch/main/gitea-maths-test.org

The short version is that it seems like go-org (which gitea currently uses) already identifies maths, but nothing is done with it. I would recommend targeting the following constructs:

Screenshots

No response

eeyrjmr commented 1 year ago

I guess the proposal should be more for Katex to work in md files not just comments.

delvh commented 1 year ago

I think that is exactly what this issue is trying to say, but you need the knowledge what go-org is…

tecosaur commented 1 year ago

I'm not sure about the support for LaTeX constructs in other plaintext markup formats Gitea supports, I just know that go-org (https://github.com/niklasfasching/go-org) is used for Org (.org files), and it recognises them.

holocronweaver commented 1 year ago

FWIW for org-mode latex I typically use dollar signs for inline ($) and display ($$), though the single-dollar has some slightly wonky rules for recognition.

Would be happy to see any support though, especially for \( and \[.

tecosaur commented 1 year ago

Yea, $ are soon to be recommended against in the official manual, there's even been talk of removing them from the syntax on the mailing list (not going to happen due to backwards compatibility concerns). So, I'd consider supporting \( and \[ much more important than $/$$.

holocronweaver commented 1 year ago

$ are soon to be recommended against in the official manual

That's unfortunate, though I can understand why, parsing would be wonky. Still, in my limited experience $ is fairly common in the wild, and as you said it isn't going away anytime soon, so would be nice to have it for compatibility. But I agree \( and \[ should have higher priority, though wide compatibility is pretty important too so having $ support would still be great.