scala / docs.scala-lang

The Scala Documentation website
http://docs.scala-lang.org
559 stars 1.02k forks source link

Fixed broken code highlight on Safari of iOS 15.7.8 #2972

Open Dieken opened 6 months ago

Dieken commented 6 months ago

On iOS, the "type A */" is rendered as "type A //", seems highlight.js is incompatible with iOS Safari, wrongly replaces "*/" with "//".

I'm not able to find the root cause, thus change to inline comment to bypass the issue.

Dieken commented 6 months ago

Upload the screenshot to show the issue.

image

bishabosha commented 6 months ago

im not sure what your original comment means, e.g. here is what I see on iOS (it is iOS 17.2.1):

IMG_A62D691D6578-1

Dieken commented 6 months ago

im not sure what your original comment means, e.g. here is what I see on iOS (it is iOS 17.2.1):

So it's a bug in webkit engine of iOS 15.7.8, I tried Chrome on iOS, same issue as the screenshot above, the trailing "*/" is rendered as "//" and the whole code snippet is rendered as comment.

Although it's not fault of scala docs, I suggest merging this patch, iOS 17.2.1 can't be installed on my poor old iPhone 7P: https://support.apple.com/guide/iphone/models-compatible-with-ios-17-iphe3fa5df43/ios

Dieken commented 6 months ago

Any more comment?

bishabosha commented 6 months ago

there are 175 of occurrences of */ in .md files in the docs, including more non-english translations of this page. Did you see any other occurrences across the site that had the same issue?

Dieken commented 6 months ago

there are 175 of occurrences of */ in .md files in the docs, including more non-english translations of this page. Did you see any other occurrences across the site that had the same issue?

I read tour of scala and scala 3 book in English, found that only strange code highlight, I wasn’t able to find the root cause, I guess it’s an incompatibility of Safari on iOS 15.7.8 with highligh.js on that special code snippet.

BTW, when I copy the wrongly rendered text, it’s really converted into “//“ that means wrong Scala syntax.

Very weird issue, this PR is just a workaround.