Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit b475cec

Browse files
author
Stephen Gutekanst
committed
frontend: improve Markdown CSS styling
Signed-off-by: Stephen Gutekanst <stephen@sourcegraph.com>
1 parent 10e1c84 commit b475cec

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

frontend/public/index.html

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,74 @@
3131

3232
<script src="/dist/elm.js"></script>
3333
<script> Elm.Main.init() </script>
34+
35+
<style>
36+
.markdown {
37+
font-family: Verdana, Geneva, sans-serif;
38+
font-size: 18px;
39+
line-height: 1.3;
40+
white-space: normal;
41+
}
42+
.markdown pre {
43+
width: 100%;
44+
white-space: pre-wrap;
45+
}
46+
.markdown code, .markdown pre {
47+
font-family: "JetBrains Mono", monospace;
48+
font-size: 16px;
49+
background: #e6e3e3;
50+
padding: 1rem;
51+
}
52+
.markdown pre>code {
53+
background: none;
54+
padding: 0;
55+
}
56+
.markdown p + p, .markdown table + p {
57+
margin-top: 1rem;
58+
}
59+
.markdown p {
60+
margin: 0;
61+
}
62+
.markdown p code {
63+
padding: 0.25rem;
64+
}
65+
.markdown table {
66+
margin-top: 1rem;
67+
border-collapse: collapse;
68+
width: calc(100% - 2rem - 2rem);
69+
margin-left: 2rem;
70+
}
71+
.markdown thead {
72+
border-bottom: 1px solid gray;
73+
}
74+
.markdown td, th {
75+
padding: 0.5rem;
76+
}
77+
.markdown tr:nth-child(even) {
78+
background: #f0f0f0;
79+
}
80+
.markdown th {
81+
padding-top: 1rem;
82+
padding-bottom: 1rem;
83+
text-align: left;
84+
}
85+
.markdown table code {
86+
background: 0;
87+
padding: 0;
88+
}
89+
.markdown blockquote {
90+
margin: 1rem;
91+
margin-left: 0.5rem;
92+
padding: 0.5rem;
93+
border-left: 3px solid #d2d2d2;
94+
}
95+
.markdown hr {
96+
height: 2px;
97+
background: #b7b7b7;
98+
border: 0;
99+
width: 100%;
100+
}
101+
102+
</style>
34103
</body>
35104
</html>

frontend/src/Markdown.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ render markdown =
2727
|> Result.andThen (\ast -> Markdown.Renderer.render Markdown.Renderer.defaultHtmlRenderer ast)
2828
of
2929
Ok rendered ->
30-
E.column [ E.htmlAttribute (Html.Attributes.style "white-space" "normal") ] (List.map (\e -> E.html e) rendered)
30+
E.column [ E.htmlAttribute (Html.Attributes.class "markdown") ] (List.map (\e -> E.html e) rendered)
3131

3232
Err errors ->
3333
E.text errors

0 commit comments

Comments
 (0)