Skip to content

Commit 5a0f70b

Browse files
committed
headers font, inline code font
1 parent 5c9d8f7 commit 5a0f70b

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

scaladoc/resources/dotty_res/styles/theme/layout/content.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080
text-decoration: underline;
8181
}
8282

83+
#content :not(pre)>code {
84+
color: var(--code-props-content);
85+
background-color: var(--code-props-background);
86+
font-family: "FiraCode-Regular";
87+
}
88+
8389
.breadcrumbs {
8490
display: none;
8591
}

scaladoc/src/dotty/tools/scaladoc/renderers/DocRenderer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class DocRender(signatureRenderer: SignatureRenderer)(using DocContext):
5757
case Title(text, level) =>
5858
val content = renderElement(text)
5959
level match
60-
case 1 => h1(cls := "h600")(content)
60+
case 1 => h1(cls := "h500")(content)
6161
case 2 => h2(cls := "h300")(content)
6262
case 3 => h3(cls := "h200")(content)
6363
case 4 => h4(cls := "h100")(content)

scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
313313
div(id := "scaladoc-searchBar"),
314314
div(id := "main")(
315315
parentsHtml,
316-
div(id := "content")(
316+
div(id := "content", cls := "body-medium")(
317317
content.content,
318318
renderTableOfContents(content.toc).fold(Nil) { toc =>
319319
div(id := "toc", cls:="body-small")(

scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
111111
Option.when(withBrief)(div(cls := "documentableBrief doc")(comment.flatMap(_.short).fold("")(renderDocPart))),
112112
Some(
113113
div(cls := "cover")(
114-
div(cls := "doc body-medium")(bodyContents),
114+
div(cls := "doc")(bodyContents),
115115
dl(cls := "attributes")(
116116
docAttributes(m),
117117
companion(m),

scaladoc/src/dotty/tools/scaladoc/tasty/comments/markdown/SectionRenderingExtension.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.vladsch.flexmark.ext.wikilink.internal.WikiLinkLinkRefProcessor
99
import com.vladsch.flexmark.util.ast._
1010
import com.vladsch.flexmark.util.options._
1111
import com.vladsch.flexmark.util.sequence.BasedSequence
12-
import com.vladsch.flexmark.util.html.AttributeImpl
12+
import com.vladsch.flexmark.util.html.{ AttributeImpl, Attributes }
1313
import com.vladsch.flexmark._
1414
import com.vladsch.flexmark.ast.FencedCodeBlock
1515

@@ -24,6 +24,16 @@ object SectionRenderingExtension extends HtmlRenderer.HtmlRendererExtension:
2424
val Section(header, body) = node
2525
val id = idGenerator.getId(header.getText)
2626
val anchor = AnchorLink(s"#$id")
27+
val attributes = Attributes()
28+
val headerClass: String = header.getLevel match
29+
case 1 => "h500"
30+
case 2 => "h300"
31+
case 3 => "h200"
32+
case 4 => "h100"
33+
case _ => "h50"
34+
attributes.addValue(AttributeImpl.of("class", headerClass))
35+
val embeddedAttributes = EmbeddedAttributeProvider.EmbeddedNodeAttributes(header, attributes)
36+
header.prependChild(embeddedAttributes)
2737
header.prependChild(anchor)
2838
html.attr(AttributeImpl.of("id", id)).withAttr.tag("section", false, false, () => {
2939
c.render(header)

scaladoc/src/dotty/tools/scaladoc/tasty/comments/markdown/SnippetRenderer.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ object SnippetRenderer:
157157
)
158158

159159
def renderWikiSnippet(content: String): String =
160-
renderSnippetWithMessages(
161-
None,
162-
content.split("\n").map(_ + "\n").toSeq,
163-
Seq.empty,
164-
false,
165-
false
166-
)
160+
val codeLines = content.split("\n").map(_ + "\n").toSeq
161+
div(cls := "snippet mono-small-block")(
162+
pre(
163+
code(
164+
raw(wrapCodeLines(codeLines).map(_.toHTML).mkString)
165+
)
166+
),
167+
div(cls := "buttons")()
168+
).toString

0 commit comments

Comments
 (0)