Skip to content

Commit 9a2af56

Browse files
committed
Improve hljs line highlighting
1 parent 422af5f commit 9a2af56

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

common/HighlightJs.re

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ let renderHLJS =
2525
Js.String2.split(highlighted, "\n")
2626
->Belt.Array.mapWithIndex((i, line) =>
2727
if (Js.Array2.find(highlightedLines, lnum => lnum === i + 1) !== None) {
28-
"<span class=\"hljs-line-highlight\">" ++ line ++ "</span>";
28+
let content = line === "" ? "&nbsp;" : line;
29+
"<span class=\"inline-block\">" ++ content ++ "</span>";
2930
} else {
30-
line;
31+
"<span class=\"inline-block text-inherit opacity-50\">"
32+
++ line
33+
++ "</span>";
3134
}
3235
)
3336
->Js.Array2.joinWith("\n");

styles/_hljs.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine
114114
/*@apply text-code-1;*/
115115
}
116116

117-
.hljs-line-highlight {
118-
@apply w-full inline-block bg-berry-15;
119-
}
120-
121117
/* DARK MODE COLORS */
122118

123119
.hljs.dark .hljs-comment {

0 commit comments

Comments
 (0)