CSS definitions for the site
This site’s CSS is generated using Clay. This file is the literate
Haskell source of the syntax highlighting code, with markdown typesetting and
bird tracks for the code, pretty much as you see here. One minor issue is
that #
can’t be used for headings, as GHC interprets it as a pragma and
refuses to parse the file.
{-# LANGUAGE OverloadedStrings #-}
OverloadedStrings is pretty much essential for working with Clay, as Clay expects a Text value rather than a String in every location you’d expect to provide character data.
module Blog.Css (
syntaxwhere
)
import Clay
import Prelude hiding ((**), span)
Because Clay’s Selectors are monoids, they can be `mappend`
ed
together. I prefer the <>
alias, because what’s Haskell without
a bunch of line noise scattered randomly throughout?
codeBorder :: Color
codeBackground,= "#eeeeee"
codeBackground = "#dddddd"
codeBorder
syntax :: Css
= do
syntax
".sourceCode" ** pre ? do
"SauceCodePro Nerd Font Mono"] [monospace]
fontFamily [1) codeBorder
border solid (px
background codeBackground".sourceCode" ** code ?
"SauceCodePro Nerd Font Mono"] [monospace]
fontFamily [
# ".lineNumbers" ? do
td 1) "#aaaaaa"
borderRight solid (px $ alignSide sideRight
textAlign "#aaaaaa"
color $ px 5
paddingRight $ px 5
paddingLeft # ".sourceCode" ? paddingLeft (px 5) td
Pandoc’s line numbering is good, in that it produces a table of two cells. This lets a user copy and paste code without the line numbers. Anyway, I like the look of it. I’m not sure how to line number literate Haskell, though.
#".sourceCode" |> span ? do
code$ pct 100
width #".sourceCode" ** ".opcodes" ? do
code$ floatRight
float $ 0.7
opacity "user-select" -: "none"
To accommodate assembed data output in Z80 assembly listings the width of the line spans is set to 100%, and the assembled data is floated right.