.cm-line {
&:has(> br:only-child) {
/* .cm-line with only one child of type
*/
@extend %empty-line !optional;
}
> br:only-child {
/* placeholder on the only-child
inside of a .cm-line, so that it works inside of a :has() pseudo-selector */
@extend %empty-line-br !optional;
}
&:where(.HyperMD-header) {
@extend %heading !optional;
}
&:where(.HyperMD-quote.HyperMD-quote-1) {
@extend %blockquote !optional;
&:where(%empty-line + *) {
/* blockquote preceeded by an empty line */
@extend %blockquote-first-line !optional;
}
&:has(+ %empty-line-br) {
/* here you have to use %empty-line-br to prevent a nested :has() pseudo-selector */
/* blockquote followed by an empty line */
@extend %blockquote-last-line !optional;
}
&:where(%empty-line + *):has(+ %empty-line-br) {
/* again, %empty-line-br to prevent a nested :has() pseudo-selector */
/* single-line blockquote */
@extend %blockquote-single-line !optional;
color: gold;
/*
An overline has to match all conditions:
1. is a blockquote (`.cm-line.HyperMD-quote.HyperMD-quote-1`)
2. has adjacent empty lines before AND after (single-line blockquote)
3. has a heading after its succeeding empty line.
*/
&:has(+ * + %heading) {
/* overline */
@extend %overline !optional;
color: lime;
/*
Selecting the empty line between the overline and the heading is relatively simple, as it can be selected as a sibling of %overline.
> `:where(%overline) + :where(%empty-line):has(+ %heading)`
*/
+ %empty-line:has(+ %heading) {
/* empty line following an overline */
@extend %overline-empty-line !optional;
background-color: lime;
}
}
/*
A subtitle has to match all conditions:
1. is a blockquote (`.cm-line.HyperMD-quote.HyperMD-quote-1`)
2. has adjacent empty lines before AND after (single-line blockquote)
3. has a heading before its preceding empty line.
How do I select the empty line between the subtitle and the heading????
> `:where(%heading) + :where(%empty-line):has(+ %subtitle)`
^ this does not work because the %subtitle placeholder in and of itself uses :has() to ensure it has a following empty line.
I can select any empty line after a heading, followed by a blockquote as such:
> `:where(%heading) + :where(%empty-line):has(+ %blockquote)`
But this isn't the desired result, as this would also select an empty line between a heading and a blockquote that is NOT a subtitle (multi-line blockquote).
*/
&:where(%heading + * + *) {
/* subtitle */
@extend %subtitle !optional;
color: cyan;
}
}
+ %empty-line:has(+ %heading) {
/* empty line following an overline */
@extend %overline-empty-line !optional;
background-color: lime;
}
}
}