summaryrefslogtreecommitdiff
path: root/Run
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-11 15:08:57 -0700
committerBen Sima <ben@bsima.me>2020-04-11 15:08:57 -0700
commit660b7aae4264fb7641b27c93adc12ed7da966702 (patch)
tree2fed08095e1cbee899cab5649a8cc29050ea8a10 /Run
parent4fd621813978bb999f1b1603f6c5a459d7a15628 (diff)
Fix fonts: remove --self-contained from pandoc
With --self-contained pandoc will embed the entire font in the HTML, which is just too much. Instead let's link it, but we have to tread the style.css as an HTML file in order to do so.
Diffstat (limited to 'Run')
-rw-r--r--Run/Que/Website.hs7
-rw-r--r--Run/Que/style.css6
2 files changed, 8 insertions, 5 deletions
diff --git a/Run/Que/Website.hs b/Run/Que/Website.hs
index 23e3740..9d96628 100644
--- a/Run/Que/Website.hs
+++ b/Run/Que/Website.hs
@@ -45,6 +45,7 @@ main = do
, style = src </> "style.css"
, apidocs = src </> "apidocs.md"
, tutorial = src </> "tutorial.md"
+ , fontLink = src </> "font.html"
}
getKey :: Namespace -> IO (Maybe Key)
@@ -70,6 +71,7 @@ data Sources = Sources
, style :: FilePath
, tutorial :: FilePath
, apidocs :: FilePath
+ , fontLink :: FilePath
}
type Namespace = Text
@@ -95,8 +97,9 @@ run key ns Sources {..} = Async.runConcurrently actions >> return ()
BS.pack
<$> Process.readProcess
"pandoc"
- [ "--self-contained"
- , "--css"
+ [ "--include-in-header"
+ , fontLink
+ , "--include-in-header"
, style
, "-i"
, md
diff --git a/Run/Que/style.css b/Run/Que/style.css
index 96fae6d..f8d1ca4 100644
--- a/Run/Que/style.css
+++ b/Run/Que/style.css
@@ -1,3 +1,5 @@
+<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,400;0,700;1,400;1,700&family=Source+Sans+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
+<style>
:root {
/* base (http://chriskempson.com/projects/base16/) */
--base00: #181818;
@@ -20,9 +22,6 @@
--base0F: #a16946;
}
-/* TODO: get this from nixpkgs when I figure out how I want to package static assets */
-@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,400;0,700;1,400;1,700&family=Source+Sans+Pro:ital,wght@0,400;0,700;1,400;1,700&family=Source+Serif+Pro:wght@400;700&display=swap');
-
/* dark theme */
@media ( prefers-color-scheme: dark ),
( prefers-color-scheme: no-preference )
@@ -134,3 +133,4 @@ pre, code
; max-width: 400px
; margin: auto
}
+</style>