Skip to content

Commit

Permalink
Fix: Style for wiki syntax (#18079)
Browse files Browse the repository at this point in the history
The purpose of this PR is to correct the style of wiki syntax when the
-comment-syntax:wiki option is enabled. There are 2 possibilities:

- First, change the tag (done in this PR): So when the correct syntax is
called up, I change the tag to strong, em, etc... instead of using a
span with a class.
- Second, change the CSS: We keep the span with a class and add the
correct CSS associated with the class.

### Code:

<img width="399" alt="Screenshot 2023-06-27 at 16 01 31"
src="https://github.com/lampepfl/dotty/assets/44496264/e75ba21f-03f5-40b2-8ce5-4356e9b933f4">

### Before:

<img width="1920" alt="Screenshot 2023-06-27 at 16 03 30"
src="https://github.com/lampepfl/dotty/assets/44496264/958bd703-4570-402a-808c-5700a0a203fe">

### After:

<img width="1920" alt="Screenshot 2023-06-27 at 16 01 34"
src="https://github.com/lampepfl/dotty/assets/44496264/35a3facb-1538-4fe0-b6ed-1bcda0e8f534">



Fix: #18051
  • Loading branch information
bishabosha authored Jun 28, 2023
2 parents 588a0b1 + ebd164c commit afe463f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scaladoc/src/dotty/tools/scaladoc/renderers/DocRenderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class DocRender(signatureRenderer: SignatureRenderer)(using DocContext):
case UnorderedList(items) => ul(listItems(items))
case OrderedList(items, style) => ol(listItems(items)) // TODO use style
case Chain(items: Seq[Inline]) => span(items.map(renderElement))
case Italic(text) => span(cls:="italic")(renderElement(text))
case Italic(text) => em(renderElement(text))
case Underline(text) => span(cls:="underline")(renderElement(text))
case Bold(text) => span(cls:="bold")(renderElement(text))
case Bold(text) => strong(renderElement(text))
case Monospace(text) => code(renderElement(text))
case Superscript(text) => span(cls:="superscript")(renderElement(text)) // TODO implement style
case Subscript(text) => span(cls:="subscript")(renderElement(text)) // TODO implement style
Expand Down
2 changes: 2 additions & 0 deletions scaladoc/src/dotty/tools/scaladoc/util/html.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ object HTML:

val div = Tag("div")
val span = Tag("span")
val em = Tag("em")
val strong = Tag("strong")
val a = Tag("a")
val p = Tag("p")
val h1 = Tag("h1")
Expand Down

0 comments on commit afe463f

Please sign in to comment.