From e50d73a88041b7d50bea449c9f4bce18059d5014 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 23 Jan 2021 10:57:54 +0100 Subject: [PATCH] Fix quote text alignment Signed-off-by: trivernis --- src/elements/mod.rs | 9 +++++++++ src/format/assets/base.scss | 2 ++ src/parser/block.rs | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/elements/mod.rs b/src/elements/mod.rs index 631de81..dffbd25 100644 --- a/src/elements/mod.rs +++ b/src/elements/mod.rs @@ -665,6 +665,15 @@ impl Quote { pub fn add_text(&mut self, text: TextLine) { self.text.push(text) } + + /// Strips a single linebreak from the end of the quote + pub fn strip_linebreak(&mut self) { + if let Some(last) = self.text.last_mut() { + if let Some(Inline::LineBreak) = last.subtext.last() { + last.subtext.pop(); + } + } + } } impl ImportAnchor { diff --git a/src/format/assets/base.scss b/src/format/assets/base.scss index adf221c..ea31aa2 100644 --- a/src/format/assets/base.scss +++ b/src/format/assets/base.scss @@ -99,6 +99,8 @@ table tr td:first-child, table tr th:first-child { blockquote { margin-left: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; background-color: rgba(0, 0, 0, 0); } diff --git a/src/parser/block.rs b/src/parser/block.rs index 2bc35e6..2a640e0 100644 --- a/src/parser/block.rs +++ b/src/parser/block.rs @@ -191,6 +191,8 @@ impl ParseBlock for Parser { break; } } + + quote.strip_linebreak(); if quote.text.len() == 0 { return Err(self.ctm.rewind_with_error(start_index).into()); }