Commit graph

4 commits

Author SHA1 Message Date
Gusted e1a82a15d3
[GITEA] Require Latex code to have a end sequence
- Currently the parser will look for `\[` and `$$` to detect when Latex
code starts, it will look for `\]` and `$$` respectively in order to
determine the end of the code. However if no end is found the parser
assumes the rest of the input is part of the Latex code.
- Adjust the parser's behavior to not allow the case to assume the rest
of the input is part of the Latex code and requires in order to
determine if some input is Latex code that the end sequence is also
specified.
- Example: `\[hello]` would no longer be detected as Latex code with
this patch.
- Added unit tests.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1817

(cherry picked from commit 452aef1bb1a5ccf986f187b6467d9827b01789f3)
(cherry picked from commit 8a857c24b0421145ece67a69d54e78af20689e0d)
(cherry picked from commit acd1456db9e5a16ad0f697b52b789cca4f96fc7c)
(cherry picked from commit 6523b45073838c168df75108b444f7fb2ef9dd2c)
(cherry picked from commit e2e1a8afe7f8a2627d518e7dc18cc7f97ca86e48)
(cherry picked from commit a46ef652ebac4422f6e4d48a676f8386dbfb7d0d)
(cherry picked from commit 54d5a8c073f49332358d181a8dd78464c6d58641)
(cherry picked from commit 4a88dc6416c7c6c552018ca0382373aa63329c9e)
(cherry picked from commit f88b58be3f6964d71094a7d7fe5067d9004a303c)
(cherry picked from commit 316ff9767ffc37a44949b6c504d465fc65ed4a60)
2024-02-05 16:09:41 +01:00
flynnnnnnnnnn e81ccc406b
Implement FSFE REUSE for golang files (#21840)
Change all license headers to comply with REUSE specification.

Fix #16132

Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2022-11-27 18:20:29 +00:00
zeripath 93df41f506
Fix slight bug in katex (#21171)
There is a small bug in #20571 whereby `$a a$b b$` will not be correctly
detected as a math inline block of `a a$b b`. This PR fixes this.

Also reenable test cases as per #21340 

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-10-05 19:55:36 +01:00
zeripath 88c2e24360
Add KaTeX rendering to Markdown. (#20571)
This PR adds mathematical rendering with KaTeX.

The first step is to add a Goldmark extension that detects the latex
(and tex) mathematics delimiters.

The second step to make this extension only run if math support is
enabled.

The second step is to then add KaTeX CSS and JS to the head which will
load after the dom is rendered.

Fix #3445

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-09-14 00:33:37 +08:00