From babb4a0c5a58ceb2e4093bc465670accdd526c18 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 30 Jan 2023 04:58:30 +0800 Subject: [PATCH] fix: prompt with nested blockquotes renders incorrectly (#846) Resolves #846 --- _includes/refactor-content.html | 48 --------------------------------- _sass/addon/commons.scss | 22 +++++++-------- 2 files changed, 10 insertions(+), 60 deletions(-) diff --git a/_includes/refactor-content.html b/_includes/refactor-content.html index e98b991..3a6f943 100644 --- a/_includes/refactor-content.html +++ b/_includes/refactor-content.html @@ -277,54 +277,6 @@ {% assign _content = _heading_content %} - - -{% assign blockquote_start = '
' %} -{% assign cls_prefix = 'prompt-' %} - -{% if _content contains blockquote_start %} - - {% assign _prompt_content = nil %} - {% assign _prompt_snippets = _content | split: blockquote_start %} - - {% for _snippet in _prompt_snippets %} - - {% if forloop.first %} - {% assign _prompt_content = _snippet %} - {% continue %} - {% endif %} - - {% assign left = _snippet | split: blockquote_end | first %} - {% assign right = _snippet | slice: left.size, _snippet.size %} - - {% assign cls_str = left | split: '>' | first %} - {% assign cls_array = cls_str | remove: '"' | split: ' ' %} - {% assign is_prompt = false %} - - {% for cls in cls_array %} - {% if cls contains cls_prefix %} - {% assign is_prompt = true %} - {% break %} - {% endif %} - {% endfor %} - - {% unless is_prompt %} - {% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %} - {% continue %} - {% endunless %} - - {% assign left = left | slice: cls_str.size, left.size %} - {% assign left = cls_str | append: '>' %} - - {% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %} - - {% endfor %} - - {% assign _content = _prompt_content %} - -{% endif %} - {{ _content }} diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 7665ab0..0991c50 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -131,9 +131,8 @@ blockquote { color: var(--blockquote-text-color); &[class^="prompt-"] { - display: flex; border-left: 0; - padding: 1rem; + padding: 1rem 1rem 1rem 3rem; color: var(--prompt-text-color); @extend %rounded; @@ -141,19 +140,15 @@ blockquote { &::before { text-align: center; width: 1.25rem; - margin-right: 0.75rem; - position: relative; - top: 0.4rem; + position: absolute; + left: 2.5rem; + margin-top: 0.4rem; text-rendering: auto; -webkit-font-smoothing: antialiased; } - > div { - max-width: calc(100% - 2rem); - - > :last-child { - margin-bottom: 0; - } + > p:last-child { + margin-bottom: 0; } } @@ -1279,11 +1274,14 @@ $sidebar-display: "sidebar-display"; .post-content { > blockquote[class^="prompt-"] { - @include pl-pr(1.25rem); @include ml-mr(-1.25rem); border-radius: 0; max-width: none; + + &::before { + left: 1rem; + } } } }