From d2fe510503e8c0edddbb80bd471d1823c453b05c Mon Sep 17 00:00:00 2001 From: Giorgio Garofalo Date: Sat, 5 Oct 2024 12:51:02 +0200 Subject: [PATCH] Add `Important` blockquote type --- .../eu/iamgio/quarkdown/ast/base/block/BlockQuote.kt | 3 ++- core/src/main/resources/render/theme/color/darko.css | 1 + core/src/main/resources/render/theme/global.css | 12 ++++++++++++ stdlib/src/main/resources/lib/localization.qmd | 2 ++ .../eu/iamgio/quarkdown/test/FullPipelineTest.kt | 5 +++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/eu/iamgio/quarkdown/ast/base/block/BlockQuote.kt b/core/src/main/kotlin/eu/iamgio/quarkdown/ast/base/block/BlockQuote.kt index 43244218..93d61bcf 100644 --- a/core/src/main/kotlin/eu/iamgio/quarkdown/ast/base/block/BlockQuote.kt +++ b/core/src/main/kotlin/eu/iamgio/quarkdown/ast/base/block/BlockQuote.kt @@ -21,12 +21,13 @@ data class BlockQuote( override fun accept(visitor: NodeVisitor) = visitor.visit(this) /** - * Specific types of quotes. + * Type a [BlockQuote] might have. */ enum class Type : RenderRepresentable { TIP, NOTE, WARNING, + IMPORTANT, ; override fun accept(visitor: RenderRepresentableVisitor): T = visitor.visit(this) diff --git a/core/src/main/resources/render/theme/color/darko.css b/core/src/main/resources/render/theme/color/darko.css index 2d874cad..a0f39872 100644 --- a/core/src/main/resources/render/theme/color/darko.css +++ b/core/src/main/resources/render/theme/color/darko.css @@ -10,6 +10,7 @@ --qd-tip-foreground-color: #86DC93; --qd-note-foreground-color: #84AAEC; --qd-warning-foreground-color: #FFB86C; + --qd-important-foreground-color: #FF7373; } hr { diff --git a/core/src/main/resources/render/theme/global.css b/core/src/main/resources/render/theme/global.css index aef3972a..54779699 100644 --- a/core/src/main/resources/render/theme/global.css +++ b/core/src/main/resources/render/theme/global.css @@ -50,6 +50,9 @@ /* Warning elements */ --qd-warning-foreground-color: rgb(161, 76, 32); --qd-warning-background-color: color-mix(in srgb, var(--qd-warning-foreground-color) 5%, transparent); + /* Important elements */ + --qd-important-foreground-color: rgb(145, 34, 34); + --qd-important-background-color: color-mix(in srgb, var(--qd-important-foreground-color) 5%, transparent); /* Reveal properties */ --r-background-color: var(--qd-background-color); @@ -166,6 +169,15 @@ blockquote.warning :first-child::before { color: var(--qd-warning-foreground-color); } +blockquote.important { + border-color: var(--qd-important-foreground-color); + background-color: var(--qd-important-background-color); +} + +blockquote.important :first-child::before { + color: var(--qd-important-foreground-color); +} + blockquote .attribution { opacity: 0.6; display: block !important; diff --git a/stdlib/src/main/resources/lib/localization.qmd b/stdlib/src/main/resources/lib/localization.qmd index f3b24826..9c7bd687 100644 --- a/stdlib/src/main/resources/lib/localization.qmd +++ b/stdlib/src/main/resources/lib/localization.qmd @@ -5,11 +5,13 @@ - note: Note - tip: Tip - warning: Warning + - important: Important - error: Error - tableofcontents: Table of Contents - Italian - note: Nota - tip: Consiglio - warning: Attenzione + - important: Importante - error: Errore - tableofcontents: Indice \ No newline at end of file diff --git a/test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt b/test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt index f0a33f70..f9174fc0 100644 --- a/test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt +++ b/test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt @@ -199,6 +199,8 @@ class FullPipelineTest { > Tip: you could try Quarkdown. > It's a cool language! > - **iamgio** + + > Important: leave a feedback! """.trimIndent(), ) { assertEquals( @@ -206,6 +208,9 @@ class FullPipelineTest { "

you could try Quarkdown.
" + "It’s a cool language!

" + "

iamgio

" + + "" + + "
" + + "

leave a feedback!

" + "
", it, )