Page MenuHomePhabricator

Non-Latin characters in <syntaxhighlight line linelinks=…> generate clickable links that don't work
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

<syntaxhighlight lang="javascript" line linelinks="ą">
a
b
c
d
</syntaxhighlight>

https://test.wikipedia.org/wiki/Linelinks

Then click the line numbers.

What happens?:

The links navigate to a URL like https://test.wikipedia.org/wiki/Linelinks#ą-2, but do not highlight the selected line, or scroll to it.

What should have happened instead?:

The links should work. If that's impossible, then there should be no links, and the limitation should be documented.

Event Timeline

The code checks if the prefix is ctype_alpha in PHP. The check for generating the links doesn't include the ctype_alpha check.

In HTML4, IDs had to start with a Latin letter[1], but in HTML5 anything goes[2], so we should probably just remove this check.

  1. https://www.w3.org/TR/html4/types.html#:~:text=ID%20and%20NAME%20tokens%20must,periods%20(%22.%22).
  2. https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute

Change 1009356 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/SyntaxHighlight_GeSHi@master] Allow linelinks prefix to be any character(s)

https://gerrit.wikimedia.org/r/1009356

Esanders renamed this task from Non-English characters in <syntaxhighlight line linelinks=…> generate clickable links that don't work to Non-Latin characters in <syntaxhighlight line linelinks=…> generate clickable links that don't work.Mar 6 2024, 9:37 PM

Change 1009356 merged by jenkins-bot:

[mediawiki/extensions/SyntaxHighlight_GeSHi@master] Allow linelinks prefix to be any character(s)

https://gerrit.wikimedia.org/r/1009356

matmarex assigned this task to Esanders.