Skip to content

Commit

Permalink
Add syntax highlighting. Closes #310
Browse files Browse the repository at this point in the history
  • Loading branch information
qria committed Aug 16, 2018
1 parent 9fe340d commit 1d405e6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Nirum/Targets/Docs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ $doctype 5
$forall Author { name = name' } <- authors md
<meta name="author" content="#{name'}">
<link rel="stylesheet" href="#{root}style.css">
<link rel="stylesheet" href="#{hljsCss}">
<script src="#{hljsJs}"></script>
<script>hljs.initHighlightingOnLoad();</script>
<body>
#{preEscapedToMarkup $ docsHeader $ target pkg}
<nav>
Expand Down Expand Up @@ -161,6 +164,16 @@ $doctype 5
documentSortKey ("", _) = (False, 0, "")
documentSortKey (fp@(fp1 : _), _) =
(isUpper fp1, length (filter (== pathSeparator) fp), fp)
hljsCss :: T.Text
hljsCss = T.concat
[ "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0"
, "/styles/github.min.css"
]
hljsJs :: T.Text
hljsJs = T.concat
[ "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/"
, "highlight.min.js"
]

typeExpression :: BoundModule Docs -> TE.TypeExpression -> Html
typeExpression _ expr = [shamlet|#{typeExpr expr}|]
Expand Down Expand Up @@ -490,7 +503,7 @@ strong code
pre
padding: 16px 10px
background-color: #{gray1}
code
code, code.hljs
background: none
div
border-top: 1px solid #{gray3}
Expand Down

0 comments on commit 1d405e6

Please sign in to comment.