File tree Expand file tree Collapse file tree 5 files changed +12
-8
lines changed
resources/dotty_res/styles/theme Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 60
60
--code-syntax-highlighting-subst : var (--yellow11 );
61
61
--code-syntax-highlighting-meta : var (--yellow11 );
62
62
--code-syntax-highlighting-string : var (--lime9 );
63
- --code-syntax-highlighting-deletion : var (--purple9 );
63
+ --code-syntax-highlighting-addition : var (--grass9 );
64
+ --code-syntax-highlighting-deletion : var (--crimson11 );
64
65
--code-syntax-highlighting-variable : var (--purple9 );
65
66
66
67
--code-method-highlighting-type : var (--purple9 );
137
138
--code-syntax-highlighting-subst : var (--yellow11 );
138
139
--code-syntax-highlighting-meta : var (--yellow11 );
139
140
--code-syntax-highlighting-string : var (--lime9 );
140
- --code-syntax-highlighting-deletion : var (--purple9 );
141
+ --code-syntax-highlighting-addition : var (--grass9 );
142
+ --code-syntax-highlighting-deletion : var (--crimson11 );
141
143
--code-syntax-highlighting-variable : var (--purple9 );
142
144
143
145
--code-method-highlighting-type : var (--purple9 );
Original file line number Diff line number Diff line change 158
158
color : var (--code-syntax-highlighting-deletion );
159
159
}
160
160
161
+ .hljs-addition {
162
+ color : var (--code-syntax-highlighting-addition );
163
+ }
164
+
161
165
.hljs-variable {
162
166
color : var (--code-syntax-highlighting-variable );
163
167
}
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ class DocRender(signatureRenderer: SignatureRenderer)(using DocContext):
64
64
case 5 => h5(cls := " h50" )(content)
65
65
case 6 => h6(cls := " h50" )(content)
66
66
case Paragraph (text) => p(renderElement(text))
67
- case Code (data : String ) => raw(SnippetRenderer .renderWikiSnippet (data))
67
+ case Code (data : String ) => raw(SnippetRenderer .renderSnippet (data))
68
68
case HorizontalRule => hr
69
69
case Table (header, columns, rows) =>
70
70
table(
Original file line number Diff line number Diff line change @@ -156,11 +156,11 @@ object SnippetRenderer:
156
156
node.compilationResult.fold(false )(_.isSuccessful)
157
157
)
158
158
159
- def renderWikiSnippet (content : String ): String =
159
+ def renderSnippet (content : String , language : Option [ String ] = None ): String =
160
160
val codeLines = content.split(" \n " ).map(_ + " \n " ).toSeq
161
161
div(cls := " snippet mono-small-block" )(
162
162
pre(
163
- code(
163
+ code(language.fold( Nil )(l => Seq (cls := s " language- $l " )))(
164
164
raw(wrapCodeLines(codeLines).map(_.toHTML).mkString)
165
165
)
166
166
),
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ object SnippetRenderingExtension extends HtmlRenderer.HtmlRendererExtension:
29
29
30
30
object FencedCodeBlockHandler extends CustomNodeRenderer [FencedCodeBlock ]:
31
31
override def render (node : FencedCodeBlock , c : NodeRendererContext , html : HtmlWriter ): Unit =
32
- html.raw(""" <div class="snippet">""" )
33
- c.delegateRender()
34
- html.raw(""" </div>""" )
32
+ html.raw(SnippetRenderer .renderSnippet(node.getContentChars.toString, node.getInfo.toString.split(" " ).headOption))
35
33
36
34
object Render extends NodeRenderer :
37
35
override def getNodeRenderingHandlers : JSet [NodeRenderingHandler [_]] =
You can’t perform that action at this time.
0 commit comments