From 60008c63f4644b0066cad4ca31b026be6e500235 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Date: Sat, 24 Jul 2021 09:21:42 -0400 Subject: [PATCH] Improved syntax highlighting. --- config.yaml | 23 ++++++++++++++----- .../2021-07-23-our-new-digital-home/index.Rmd | 18 ++++++++++++--- layouts/partials/head.html | 1 + static/assets/css/custom.css | 14 +++++++++-- static/assets/css/kube.css | 8 ++----- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/config.yaml b/config.yaml index 01187b0..e877141 100755 --- a/config.yaml +++ b/config.yaml @@ -3,7 +3,7 @@ languageCode: "en-us" title: "CleverThis.com" enableEmoji: true pygmentsCodefences: true -pygmentsStyle: "lovelace" +pygmentsStyle: "emacs" ignoreFiles: ["\\.Rmd$", "\\.Rmarkdown", _files$", "_cache$"] canonifyURLs: true permalinks: @@ -22,13 +22,8 @@ params: inbox: https://cleverthis.com/activitypub/inbox publickeypem: -----BEGIN PUBLIC KEY-----... rssLimit: 50 -markup: - goldmark: - renderer: - unsafe: true module: imports: - # The hugo-activitystreams module: - path: hugo-activitystreams outputs: home: @@ -38,3 +33,19 @@ outputs: page: - "html" # Default - "activity" +markup: + goldmark: + renderer: + unsafe: true + highlight: + anchorLineNos: false + codeFences: true + guessSyntax: false + hl_Lines: "" + lineAnchors: "" + lineNoStart: 1 + lineNos: true + lineNumbersInTable: true + noClasses: false + style: solarized-light + tabWidth: 2 diff --git a/content/articles/2021-07-23-our-new-digital-home/index.Rmd b/content/articles/2021-07-23-our-new-digital-home/index.Rmd index 53c55cd..32a10ec 100644 --- a/content/articles/2021-07-23-our-new-digital-home/index.Rmd +++ b/content/articles/2021-07-23-our-new-digital-home/index.Rmd @@ -79,11 +79,23 @@ I've supported D.C. publicly, been on their podcast & pay for their service. I'm ## Syntax highlighting +{{< highlight java >}} +int foo = 5; +fooBar(7); +if(5 > foo) { + farBoo(foo, 7, "jeff"); +} +{{</highlight>}} + +or with backticks + ```java - int foo = 5; - fooBar(7); +int foo = 5; +fooBar(7); +if(5 > foo) { + farBoo(foo, 7, "jeff"); +} ``` - ## Math {{<math>}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 20a3a40..82802da 100755 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -16,6 +16,7 @@ <link rel="stylesheet" href="{{ $asset_base }}assets/css/tufte.css" /> {{ if .Params.comments | default false }} <link rel="stylesheet" href="{{ $asset_base }}assets/css/comments.css" /> + <link rel="stylesheet" href="{{ $asset_base }}assets/css/syntax.css" /> {{ end }} <!-- Fonts --> <link href='https://fonts.googleapis.com/css?family=Alegreya:400italic,400,700,700italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'> diff --git a/static/assets/css/custom.css b/static/assets/css/custom.css index 7babd99..35a3b6c 100755 --- a/static/assets/css/custom.css +++ b/static/assets/css/custom.css @@ -85,9 +85,7 @@ pre { pre code { line-height: 1.4em; - font-size: 85%; font-family: "Hack", Menlo, Monaco, Consolas, "Courier New", monospace; - background-color: #f0f3f3; padding: 8px; width: 100%; border-radius: 0; @@ -524,3 +522,15 @@ header h1 { float: left; margin-right: 16px; } + +/*---------------------------------------------*/ + +.highlight pre code { + font-size: 110%; +} + +.highlight pre { + border-left-color: #e4c601; + border-left-width: 3px; + border-left-style: dotted; +} diff --git a/static/assets/css/kube.css b/static/assets/css/kube.css index e3518d9..04599e9 100644 --- a/static/assets/css/kube.css +++ b/static/assets/css/kube.css @@ -363,7 +363,7 @@ time, small { line-height: 1; color: rgba(17, 17, 19, 0.6); } -figcaption, code, var, kbd { +figcaption, var, kbd { display: inline-block; font-family: monospace, monospace; font-size: 87.5%; @@ -376,8 +376,6 @@ figcaption { color: rgba(17, 17, 19, 0.7); } code { - color: rgba(17, 17, 19, 0.75); - background: rgba(17, 17, 19, 0.05); border: 0 solid transparent; border-radius: 4px; } @@ -431,12 +429,10 @@ pre { pre, pre code { - background: transparent; padding: 0; top: 0; display: block; line-height: 1.5; - color: #111113; overflow: auto; white-space: pre; } @@ -448,7 +444,7 @@ pre { pre code { font-size: 100%; border: none; - background: none; } +} figure div + figcaption, figure pre + figcaption { -- GitLab