Skip to content

Commit

Permalink
Add Important blockquote type
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgio committed Oct 5, 2024
1 parent ac196d1 commit d2fe510
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ data class BlockQuote(
override fun <T> accept(visitor: NodeVisitor<T>) = visitor.visit(this)

/**
* Specific types of quotes.
* Type a [BlockQuote] might have.
*/
enum class Type : RenderRepresentable {
TIP,
NOTE,
WARNING,
IMPORTANT,
;

override fun <T> accept(visitor: RenderRepresentableVisitor<T>): T = visitor.visit(this)
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/render/theme/color/darko.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions core/src/main/resources/render/theme/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions stdlib/src/main/resources/lib/localization.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,18 @@ class FullPipelineTest {
> Tip: you could try Quarkdown.
> It's a cool language!
> - **iamgio**
> Important: leave a feedback!
""".trimIndent(),
) {
assertEquals(
"<blockquote class=\"tip\" style=\"--quote-type-label: 'Consiglio';\" data-labeled=\"\">" +
"<p>you could try Quarkdown.<br />" +
"It&rsquo;s a cool language!</p>" +
"<p class=\"attribution\"><strong>iamgio</strong></p>" +
"</blockquote>" +
"<blockquote class=\"important\" style=\"--quote-type-label: 'Importante';\" data-labeled=\"\">" +
"<p>leave a feedback!</p>" +
"</blockquote>",
it,
)
Expand Down

0 comments on commit d2fe510

Please sign in to comment.