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 6060 --code-syntax-highlighting-subst : var (--yellow11 );
6161 --code-syntax-highlighting-meta : var (--yellow11 );
6262 --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 );
6465 --code-syntax-highlighting-variable : var (--purple9 );
6566
6667 --code-method-highlighting-type : var (--purple9 );
137138 --code-syntax-highlighting-subst : var (--yellow11 );
138139 --code-syntax-highlighting-meta : var (--yellow11 );
139140 --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 );
141143 --code-syntax-highlighting-variable : var (--purple9 );
142144
143145 --code-method-highlighting-type : var (--purple9 );
Original file line number Diff line number Diff line change 158158 color : var (--code-syntax-highlighting-deletion );
159159}
160160
161+ .hljs-addition {
162+ color : var (--code-syntax-highlighting-addition );
163+ }
164+
161165.hljs-variable {
162166 color : var (--code-syntax-highlighting-variable );
163167}
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ class DocRender(signatureRenderer: SignatureRenderer)(using DocContext):
6464 case 5 => h5(cls := " h50" )(content)
6565 case 6 => h6(cls := " h50" )(content)
6666 case Paragraph (text) => p(renderElement(text))
67- case Code (data : String ) => raw(SnippetRenderer .renderWikiSnippet (data))
67+ case Code (data : String ) => raw(SnippetRenderer .renderSnippet (data))
6868 case HorizontalRule => hr
6969 case Table (header, columns, rows) =>
7070 table(
Original file line number Diff line number Diff line change @@ -156,11 +156,11 @@ object SnippetRenderer:
156156 node.compilationResult.fold(false )(_.isSuccessful)
157157 )
158158
159- def renderWikiSnippet (content : String ): String =
159+ def renderSnippet (content : String , language : Option [ String ] = None ): String =
160160 val codeLines = content.split(" \n " ).map(_ + " \n " ).toSeq
161161 div(cls := " snippet mono-small-block" )(
162162 pre(
163- code(
163+ code(language.fold( Nil )(l => Seq (cls := s " language- $l " )))(
164164 raw(wrapCodeLines(codeLines).map(_.toHTML).mkString)
165165 )
166166 ),
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ object SnippetRenderingExtension extends HtmlRenderer.HtmlRendererExtension:
2929
3030 object FencedCodeBlockHandler extends CustomNodeRenderer [FencedCodeBlock ]:
3131 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))
3533
3634 object Render extends NodeRenderer :
3735 override def getNodeRenderingHandlers : JSet [NodeRenderingHandler [_]] =
You can’t perform that action at this time.
0 commit comments