Skip to content

Commit

Permalink
Fixed broken code highlight on Safari of iOS 15.7.8
Browse files Browse the repository at this point in the history
On iOS, the "type `A` */" is rendered as "type `A` //", it's probably a bug
in webkit engine of iOS 15.7.8, newer iOS doesn't have this issue, see
#2972 (comment)

I'm not able to find the root cause, thus change to inline comment to bypass
the issue for my old iPhone 7 Plus.
  • Loading branch information
Dieken committed Feb 14, 2024
1 parent d626b36 commit 00fab29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions _overviews/scala3-book/ca-context-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ existing method `max` on `List`, but we made up this example for illustration pu

{% tab 'Scala 2' %}
```scala
/** Defines how to compare values of type `A` */
// Defines how to compare values of type `A`
trait Ord[A] {
def greaterThan(a1: A, a2: A): Boolean
}

/** Returns the maximum of two values */
// Returns the maximum of two values
def max[A](a1: A, a2: A)(implicit ord: Ord[A]): A =
if (ord.greaterThan(a1, a2)) a1 else a2
```
{% endtab %}

{% tab 'Scala 3' %}
```scala
/** Defines how to compare values of type `A` */
// Defines how to compare values of type `A`
trait Ord[A]:
def greaterThan(a1: A, a2: A): Boolean

/** Returns the maximum of two values */
// Returns the maximum of two values
def max[A](a1: A, a2: A)(using ord: Ord[A]): A =
if ord.greaterThan(a1, a2) then a1 else a2
```
Expand Down
8 changes: 4 additions & 4 deletions _zh-cn/overviews/scala3-book/ca-context-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ def maxElement[A](as: List[A])(using ord: Ord[A]): A =
{% tabs context-bounds-max-ord class=tabs-scala-version %}
{% tab 'Scala 2' %}
```scala
/** Defines how to compare values of type `A` */
// Defines how to compare values of type `A`
trait Ord[A] {
def greaterThan(a1: A, a2: A): Boolean
}

/** Returns the maximum of two values */
// Returns the maximum of two values
def max[A](a1: A, a2: A)(implicit ord: Ord[A]): A =
if (ord.greaterThan(a1, a2)) a1 else a2
```
{% endtab %}

{% tab 'Scala 3' %}
```scala
/** Defines how to compare values of type `A` */
// Defines how to compare values of type `A`
trait Ord[A]:
def greaterThan(a1: A, a2: A): Boolean

/** Returns the maximum of two values */
// Returns the maximum of two values
def max[A](a1: A, a2: A)(using ord: Ord[A]): A =
if ord.greaterThan(a1, a2) then a1 else a2
```
Expand Down

0 comments on commit 00fab29

Please sign in to comment.