Skip to content

Commit babb4a0

Browse files
committed
fix: prompt with nested blockquotes renders incorrectly (#846)
Resolves #846
1 parent 511df11 commit babb4a0

File tree

2 files changed

+10
-60
lines changed

2 files changed

+10
-60
lines changed

_includes/refactor-content.html

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -277,54 +277,6 @@
277277

278278
{% assign _content = _heading_content %}
279279

280-
<!-- Wrap prompt element of blockquote with the <div> tag -->
281-
282-
{% assign blockquote_start = '<blockquote class=' %}
283-
{% assign blockquote_end = '</blockquote>' %}
284-
{% assign cls_prefix = 'prompt-' %}
285-
286-
{% if _content contains blockquote_start %}
287-
288-
{% assign _prompt_content = nil %}
289-
{% assign _prompt_snippets = _content | split: blockquote_start %}
290-
291-
{% for _snippet in _prompt_snippets %}
292-
293-
{% if forloop.first %}
294-
{% assign _prompt_content = _snippet %}
295-
{% continue %}
296-
{% endif %}
297-
298-
{% assign left = _snippet | split: blockquote_end | first %}
299-
{% assign right = _snippet | slice: left.size, _snippet.size %}
300-
301-
{% assign cls_str = left | split: '>' | first %}
302-
{% assign cls_array = cls_str | remove: '"' | split: ' ' %}
303-
{% assign is_prompt = false %}
304-
305-
{% for cls in cls_array %}
306-
{% if cls contains cls_prefix %}
307-
{% assign is_prompt = true %}
308-
{% break %}
309-
{% endif %}
310-
{% endfor %}
311-
312-
{% unless is_prompt %}
313-
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %}
314-
{% continue %}
315-
{% endunless %}
316-
317-
{% assign left = left | slice: cls_str.size, left.size %}
318-
{% assign left = cls_str | append: '><div' | append: left | append: '</div>' %}
319-
320-
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %}
321-
322-
{% endfor %}
323-
324-
{% assign _content = _prompt_content %}
325-
326-
{% endif %}
327-
328280
<!-- return -->
329281

330282
{{ _content }}

_sass/addon/commons.scss

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,29 +131,24 @@ blockquote {
131131
color: var(--blockquote-text-color);
132132

133133
&[class^="prompt-"] {
134-
display: flex;
135134
border-left: 0;
136-
padding: 1rem;
135+
padding: 1rem 1rem 1rem 3rem;
137136
color: var(--prompt-text-color);
138137

139138
@extend %rounded;
140139

141140
&::before {
142141
text-align: center;
143142
width: 1.25rem;
144-
margin-right: 0.75rem;
145-
position: relative;
146-
top: 0.4rem;
143+
position: absolute;
144+
left: 2.5rem;
145+
margin-top: 0.4rem;
147146
text-rendering: auto;
148147
-webkit-font-smoothing: antialiased;
149148
}
150149

151-
> div {
152-
max-width: calc(100% - 2rem);
153-
154-
> :last-child {
155-
margin-bottom: 0;
156-
}
150+
> p:last-child {
151+
margin-bottom: 0;
157152
}
158153
}
159154

@@ -1279,11 +1274,14 @@ $sidebar-display: "sidebar-display";
12791274

12801275
.post-content {
12811276
> blockquote[class^="prompt-"] {
1282-
@include pl-pr(1.25rem);
12831277
@include ml-mr(-1.25rem);
12841278

12851279
border-radius: 0;
12861280
max-width: none;
1281+
1282+
&::before {
1283+
left: 1rem;
1284+
}
12871285
}
12881286
}
12891287
}

0 commit comments

Comments
 (0)