Fix blockquote issues
This commit is contained in:
parent
725a77318a
commit
d6f16fe65e
|
@ -71,10 +71,12 @@ input,
|
|||
label,
|
||||
a,
|
||||
blockquote,
|
||||
figcaption,
|
||||
aside,
|
||||
ol,
|
||||
ul {
|
||||
font-size: calc(var(--font-size) * 1.33);
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
h1,
|
||||
|
@ -87,26 +89,22 @@ h6 {
|
|||
}
|
||||
|
||||
aside,
|
||||
blockquote {
|
||||
border: var(--border);
|
||||
}
|
||||
|
||||
blockquote,
|
||||
aside {
|
||||
figure {
|
||||
padding: var(--default-padding) calc(var(--default-padding) * 2);
|
||||
border: var(--border);
|
||||
max-inline-size: 100%;
|
||||
margin-inline: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
&::before {
|
||||
content: '“';
|
||||
font-weight: 600;
|
||||
}
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '”';
|
||||
font-weight: 600;
|
||||
figure {
|
||||
& figcaption {
|
||||
font-style: italic;
|
||||
margin-inline-start: var(--default-padding);
|
||||
margin-block-start: var(--default-padding);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ pub(crate) enum Block {
|
|||
},
|
||||
quote {
|
||||
text: String,
|
||||
caption: String,
|
||||
},
|
||||
embed {
|
||||
service: String,
|
||||
|
@ -78,7 +79,13 @@ impl Block {
|
|||
}
|
||||
},
|
||||
Block::warning { title } => ["<aside>", title, "</aside>"].concat(),
|
||||
Block::quote { text } => ["<blockquote>", text, "</blockquote>"].concat(),
|
||||
Block::quote { text, caption } => {
|
||||
if caption.is_empty() {
|
||||
["<figure><blockquote>“", text, "”</blockquote></figure>"].concat()
|
||||
} else {
|
||||
["<figure><blockquote>“", text, "”</blockquote><figcaption>— ", caption,"</figcaption></figure>"].concat()
|
||||
}
|
||||
},
|
||||
Block::embed {
|
||||
embed,
|
||||
width,
|
||||
|
@ -109,7 +116,7 @@ impl Block {
|
|||
Block::header { text, level: _ } => text,
|
||||
Block::list { style: _, items } => &items.join("\n"),
|
||||
Block::warning { title } => title,
|
||||
Block::quote { text } => text,
|
||||
Block::quote { text, caption } => &[text, caption.as_str()].concat(),
|
||||
_ => &"".to_string(),
|
||||
};
|
||||
let text = [text, "\n"].concat();
|
||||
|
@ -241,14 +248,17 @@ impl Blocks {
|
|||
Block::paragraph { text: _ } => true,
|
||||
Block::header { text: _, level } => *level > 1,
|
||||
Block::warning { title: _ } => true,
|
||||
Block::quote { text: _ } => true,
|
||||
Block::quote {
|
||||
text: _,
|
||||
caption: _,
|
||||
} => true,
|
||||
_ => false,
|
||||
})
|
||||
.map(|block| match block {
|
||||
Block::paragraph { text } => text,
|
||||
Block::header { text, level: _ } => text,
|
||||
Block::warning { title } => title,
|
||||
Block::quote { text } => text,
|
||||
Block::quote { text, caption: _ } => text,
|
||||
_ => "...",
|
||||
})
|
||||
.unwrap_or("No description"),
|
||||
|
|
Loading…
Reference in New Issue