forgejo/modules/markup/markdown
TurtleArmy 2b42fdaa26 feat(ui): Fix comma separated attributes in code blocks language preventing syntax-highlighting (#12056)
Currently, forgejo does not support syntax highlighting code-blocks that have comma separated attributes after the language. This is a pattern sometimes seen in Rust code blocks, with tests like this:

\`\`\`rust
#[test]
fn run_this_test() { /* ... */ }
\`\`\`

\`\`\`rust,ignore
#[test]
fn skip_this_test() { /* ... */ }
\`\`\`

Currently, forgejo only does syntax highlighting in the first case:

```rust
#[test]
fn run_this_test() { /* ... */ }
```

```rust,ignore
#[test]
fn skip_this_test() { /* ... */ }
```

An example of this causing problems can be seen in this commit (5be9c5b7d2) causing the following issue (https://codeberg.org/zesterer/ariadne/issues/188).

This PR fixes fixes the second case not getting proper syntax highlighting.

Co-authored-by: TurtleArmy <44322335+TurtleArmyMc@users.noreply.github.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12056
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Ellen Εμίλια Άννα Zscheile <fogti@noreply.codeberg.org>
Co-authored-by: TurtleArmy <turtlearmy@noreply.codeberg.org>
Co-committed-by: TurtleArmy <turtlearmy@noreply.codeberg.org>
2026-04-12 18:30:30 +02:00
..
callout chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
math chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
util fix: enable multi-line math equations in wiki (#8424) 2025-07-06 22:00:09 +02:00
ast.go chore: Remove IsXXX 2025-01-31 16:22:29 +01:00
color_util.go feat: support color dots for 4 character hex. 2024-11-02 13:37:14 +01:00
color_util_test.go feat: support color dots for 4 character hex. 2024-11-02 13:37:14 +01:00
convertyaml.go chore: replace gopkg.in/yaml.v3 with go.yaml.in/yaml/v3 (#8956) 2025-08-20 15:31:12 +02:00
goldmark.go feat(ui): Fix comma separated attributes in code blocks language preventing syntax-highlighting (#12056) 2026-04-12 18:30:30 +02:00
markdown.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
markdown_test.go feat(ui): Fix comma separated attributes in code blocks language preventing syntax-highlighting (#12056) 2026-04-12 18:30:30 +02:00
meta.go chore: replace gopkg.in/yaml.v3 with go.yaml.in/yaml/v3 (#8956) 2025-08-20 15:31:12 +02:00
meta_test.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
prefixed_id.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
renderconfig.go chore: replace gopkg.in/yaml.v3 with go.yaml.in/yaml/v3 (#8956) 2025-08-20 15:31:12 +02:00
renderconfig_test.go chore: replace gopkg.in/yaml.v3 with go.yaml.in/yaml/v3 (#8956) 2025-08-20 15:31:12 +02:00
toc.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
transform_codeblock_lang.go feat(ui): Fix comma separated attributes in code blocks language preventing syntax-highlighting (#12056) 2026-04-12 18:30:30 +02:00
transform_codespan.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
transform_heading.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
transform_html.go Add to html button in markdown type="button" (#10520) 2025-12-21 05:21:27 +01:00
transform_image.go fix(ui): add missing lazy load attribute to images (#8246) 2025-06-25 18:31:03 +02:00
transform_link.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
transform_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00