-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Closed
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug
Description
- Gitea version (or commit ref): 1.7.1
- Git version: n/a
- Operating system: Windows 10
- Database (use
[x]
):- PostgreSQLTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Can you reproduce the bug at https://try.gitea.io:
- To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Log gist: n/a
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
##
Screenshots
Metadata
Metadata
Assignees
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
oscarlofwenhamn commentedon Feb 14, 2019
Another example can be found in the example posted in #6064.
zeripath commentedon Feb 19, 2019
Hi!
Is this still an issue on try.gitea.io?
The revision that fixed #6064 probably fixed this.
oscarlofwenhamn commentedon Feb 19, 2019
Hi,
Yes, this problem remains (see my repo for an example: https://try.gitea.io/foobarbleh/foo).
silverwind commentedon Feb 19, 2019
I suspect a highlight.js issue here.
oscarlofwenhamn commentedon Feb 20, 2019
Is Gitea running the latest version? Could this be something to report to the highlight.js team?
silverwind commentedon Feb 20, 2019
highlight.js is 9.11.0, latest is 9.14.0.
It would help if you can showcase the issue in a fiddle like this, using the latest version.
oscarlofwenhamn commentedon Feb 21, 2019
I'm new to using fiddle, but I've given it a shot here. (I'm guessing there's no way of embedding fiddles on GitHub?)
One of the variants that are broken on Gitea works in the fiddle, but the second example remains broken. Let me know if there are any modifications or corrections that should be made to the fiddle and I'll sort it out.
Fiddle output screenshot:

oscarlofwenhamn commentedon Feb 27, 2019
If this isn't a priority issue for the general group, could anyone point me towards where (if possible) I could define what version of Highlight.js my instance should run? It would be nice to have this in upstream, but I would gladly sort out a local fix if this is not a priority issue.
jolheiser commentedon Feb 27, 2019
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 ofhighlight.js
to yourcustom/public/js
folder.Docs for customizing templates
silverwind commentedon Feb 27, 2019
Updated fiddle with 9.15.6: https://jsfiddle.net/vk3j2gLd/3/
All three cases look alright, correct?
oscarlofwenhamn commentedon Feb 28, 2019
Yes, this looks great!
I'm gonna test it out with a local workaround, thanks for the suggestion @jolheiser. I'll get it done right away and post an update here, and if it works I'll close this issue and open a new one for updating highligt.js, if no one objects.
silverwind commentedon Feb 28, 2019
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:
oscarlofwenhamn commentedon Feb 28, 2019
I can confirm that the variants listed in the fiddle all work with newer highlight.js, using the resources you've provided.
I did, however, notice another breaking variant. If I write three or more lines with two or more #'s, it still breaks, looking like the third line of #'s gets interpreted as something very particular as it gets uniquely highlighted.
This still is an improvement, but it is unfortunate as the user who raised the issue has a habit of tagging his codes with exactly that: opening with several lines of several #'s ... I will just have to ask him not to.
7 remaining items
oscarlofwenhamn commentedon Jul 17, 2019
Sorry, mistakenly closed the issue.
Add a lot of extension to language mappings for syntax highlights (#7741