From 5898ae0230db006c8a64b0fceafd84939606c3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:51:11 +0200 Subject: [PATCH 1/8] fix: add metadata variable --- src/format/html/format-html-scss.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/format/html/format-html-scss.ts b/src/format/html/format-html-scss.ts index d2abcdfc93b..b48bf7d35de 100644 --- a/src/format/html/format-html-scss.ts +++ b/src/format/html/format-html-scss.ts @@ -441,6 +441,7 @@ function pandocVariablesToThemeDefaults( add(explicitVars, "font-family-base", metadata["mainfont"], asCssFont); add(explicitVars, "font-family-code", metadata["monofont"], asCssFont); add(explicitVars, "mono-background-color", metadata["monobackgroundcolor"]); + add(explicitVars, "mono-foreground-color", metadata["monoforegroundcolor"]); // Deal with sizes const explicitSizes = [ From 59ef7e769b6b012b0ff5639d09142ab33004e943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:51:49 +0200 Subject: [PATCH 2/8] fix: add metadata variable for reveal.js --- src/format/reveal/format-reveal-theme.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/format/reveal/format-reveal-theme.ts b/src/format/reveal/format-reveal-theme.ts index d01ba39bf26..7936b9f617c 100644 --- a/src/format/reveal/format-reveal-theme.ts +++ b/src/format/reveal/format-reveal-theme.ts @@ -247,6 +247,7 @@ function pandocVariablesToRevealDefaults( asCssNumber, ); add(explicitVars, "code-block-bg", metadata["monobackgroundcolor"]); + add(explicitVars, "code-block-color", metadata["monoforegroundcolor"]); return explicitVars; } From 9f51105c545e856768c2d73f538dda49a661f7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:52:39 +0200 Subject: [PATCH 3/8] fix: update CSS rule (merging the ducplicated ones) --- .../html/bootstrap/_bootstrap-rules.scss | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss index 20ffbd0ce11..4c805ded676 100644 --- a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss +++ b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss @@ -914,23 +914,22 @@ pre { border: initial; } -// Maps the pandoc 'monobackgroundcolor' to bootstrap +/ Maps the pandoc 'monobackgroundcolor' to bootstrap // Note this only targets code outside of sourceCode blocks -@if variable-exists(mono-background-color) { - p code:not(.sourceCode), - li code:not(.sourceCode), - kbd, - pre:not(.sourceCode), - samp { - background-color: $mono-background-color; - padding: 0.2em; - } -} // Default padding if background is set +h1 code:not(.sourceCode), +h2 code:not(.sourceCode), +h3 code:not(.sourceCode), +h4 code:not(.sourceCode), +h5 code:not(.sourceCode), +h6 code:not(.sourceCode), p code:not(.sourceCode), li code:not(.sourceCode), -td code:not(.sourceCode) { +td code:not(.sourceCode), +kbd, +pre:not(.sourceCode), +samp { @if variable-exists(mono-background-color) { background-color: $mono-background-color; } @else if variable-exists(code-bg) { From 1e19b43fce5343ffc057eaef847e18eea38ddb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:53:03 +0200 Subject: [PATCH 4/8] fix: missing slash for comment --- src/resources/formats/html/bootstrap/_bootstrap-rules.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss index 4c805ded676..ef6fdcf82a5 100644 --- a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss +++ b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss @@ -914,7 +914,7 @@ pre { border: initial; } -/ Maps the pandoc 'monobackgroundcolor' to bootstrap +// Maps the pandoc 'monobackgroundcolor' to bootstrap // Note this only targets code outside of sourceCode blocks // Default padding if background is set From fe8f4be8d93c00babe4697598f172c6b0b36e67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:54:04 +0200 Subject: [PATCH 5/8] fix: add foreground variable to template --- src/resources/formats/html/pandoc/styles.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/resources/formats/html/pandoc/styles.html b/src/resources/formats/html/pandoc/styles.html index 931a4e78915..3482d0073d4 100644 --- a/src/resources/formats/html/pandoc/styles.html +++ b/src/resources/formats/html/pandoc/styles.html @@ -119,6 +119,9 @@ $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: .2em .4em; + $endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ font-size: 85%; margin: 0; @@ -129,6 +132,9 @@ $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: 1em; +$endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ overflow: auto; } From 13df03299a345611ed83b221814f354d4bd8e22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:55:16 +0200 Subject: [PATCH 6/8] fix: add new monoforegroundcolor option to schema --- src/resources/schema/document-colors.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/resources/schema/document-colors.yml b/src/resources/schema/document-colors.yml index a459fe6dfc0..0092edfb5b1 100644 --- a/src/resources/schema/document-colors.yml +++ b/src/resources/schema/document-colors.yml @@ -26,6 +26,12 @@ formats: [html, html4, html5, slidy, slideous, s5, dzslides] description: Sets the CSS `background-color` property on code elements and adds extra padding. +- name: monoforegroundcolor + schema: string + tags: + formats: [html, html4, html5, slidy, slideous, s5, dzslides] + description: Sets the CSS `color` property on code elements and adds extra padding. + - name: backgroundcolor schema: string tags: From f3770a58c20cb029992d8e6da40baa418ff5053e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:55:42 +0200 Subject: [PATCH 7/8] fix: add monoforeground color to html template --- src/resources/formats/html/pandoc/html.styles | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/resources/formats/html/pandoc/html.styles b/src/resources/formats/html/pandoc/html.styles index 58fff9f2f03..25ea19c2479 100644 --- a/src/resources/formats/html/pandoc/html.styles +++ b/src/resources/formats/html/pandoc/html.styles @@ -107,6 +107,9 @@ code { $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: .2em .4em; +$endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ font-size: 85%; margin: 0; @@ -117,6 +120,9 @@ pre { $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: 1em; +$endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ overflow: auto; } From 12148068ba79239d8eaee151e89ce3848606fd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:59:16 +0200 Subject: [PATCH 8/8] fix: add mono-foreground-color in css rule --- .../formats/html/bootstrap/_bootstrap-rules.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss index ef6fdcf82a5..26d6b44b766 100644 --- a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss +++ b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss @@ -936,12 +936,20 @@ samp { background-color: $code-bg; } + @if variable-exists(mono-foreground-color) { + color: $mono-foreground-color; + } @else if variable-exists(code-color) { + color: $code-color; + } + @if variable-exists(code-padding) { padding: $code-padding; } @else if variable-exists(code-bg) { padding: 0.2em; } @else if variable-exists(mono-background-color) { padding: 0.2em; + } @else if variable-exists(mono-foreground-color) { + padding: 0.2em; } }