diff --git a/core/src/main/kotlin/eu/iamgio/quarkdown/rendering/html/QuarkdownHtmlNodeRenderer.kt b/core/src/main/kotlin/eu/iamgio/quarkdown/rendering/html/QuarkdownHtmlNodeRenderer.kt index 4af3f904..bd683942 100644 --- a/core/src/main/kotlin/eu/iamgio/quarkdown/rendering/html/QuarkdownHtmlNodeRenderer.kt +++ b/core/src/main/kotlin/eu/iamgio/quarkdown/rendering/html/QuarkdownHtmlNodeRenderer.kt @@ -318,9 +318,15 @@ class QuarkdownHtmlNodeRenderer(context: Context) : BaseHtmlNodeRenderer(context // and a localized label is shown (e.g. 'Tip:' for English). node.type?.asCSS?.let { type -> `class`(type) - // The localized label is set as a CSS variable. - // Themes can customize label appearance and formatting. - style { "--quote-type-label" value context.localizeOrNull(type)?.let { "'$it'" } } + // The type is associated to a localized label + // only if the documant language is set and the set language is supported. + context.localizeOrNull(type)?.let { localizedLabel -> + // The localized label is set as a CSS variable. + // Themes can customize label appearance and formatting. + style { "--quote-type-label" value "'$localizedLabel'" } + // The quote is marked as labeled to allow further customization. + attribute("data-labeled", "") + } } +node.children diff --git a/core/src/main/resources/render/theme/global.css b/core/src/main/resources/render/theme/global.css index 78fcfe4a..3288fb50 100644 --- a/core/src/main/resources/render/theme/global.css +++ b/core/src/main/resources/render/theme/global.css @@ -109,7 +109,7 @@ blockquote[class] { --quote-type-label: ""; } -blockquote[class] :first-child::before { +blockquote[class][data-labeled] :first-child::before { content: var(--quote-type-label) var(--qd-quote-type-label-suffix); font-weight: bold; } 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 c57be773..a725024b 100644 --- a/test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt +++ b/test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt @@ -182,7 +182,7 @@ class FullPipelineTest { """.trimIndent(), ) { assertEquals( - "
" + + "" + "you could try Quarkdown.
" + "
" + "It’s a cool language!iamgio
" +