gitea: Multinline comments in the start break syntax highlighting

Description

When starting a file with a multiline comment or sometimes multiple lines of comments, syntax highlighting breaks (at least for .ps1 files).

For example, starting a file with one of the following works fine:

# Foo
---
<# Bar #>
---
# Bleh
#

This, however, breaks it:

<# Foo
#>
---
## Bar
##

Sample files in repo

Screenshots

image

image

image

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (19 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah, highlight.js weirdly does not publish a proper packed file with all languagues anywhere. I assume if we want to update it, we should include all languages which results in a 650kb file, not that much of a problem.

Once you confirm it works with in Gitea with newer highlight.js, I can raise a PR to update it. You want to use these resources:

https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/default.min.css
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js

Updated fiddle with 9.15.6: https://jsfiddle.net/vk3j2gLd/3/

All three cases look alright, correct?

A temporary local workaround could be to use a custom footer template that instead gets highlight.js from {{AppSubUrl}}/js/highlight.js and then add the new version of highlight.js to your custom/public/js folder.
Docs for customizing templates

I suspect a highlight.js issue here.