Style a line containng only "#" as if it were to become a tag instead of a header
parent
4fa58aaafd
commit
7ddd7c4011
|
@ -92,6 +92,17 @@ export function hideHeaderMarkPlugin() {
|
||||||
}
|
}
|
||||||
// Get the active line
|
// Get the active line
|
||||||
const line = state.sliceDoc(from, to);
|
const line = state.sliceDoc(from, to);
|
||||||
|
if (line === "#") {
|
||||||
|
// Empty header, potentially a tag, style it as such
|
||||||
|
widgets.push(
|
||||||
|
Decoration.mark({
|
||||||
|
tagName: "span",
|
||||||
|
class: "sb-hashtag",
|
||||||
|
}).range(from, from + 1),
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isCursorInRange(state, [from, to])) {
|
if (isCursorInRange(state, [from, to])) {
|
||||||
widgets.push(
|
widgets.push(
|
||||||
Decoration.line({ class: "sb-header-inside" }).range(from),
|
Decoration.line({ class: "sb-header-inside" }).range(from),
|
||||||
|
|
|
@ -50,6 +50,17 @@
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a header only contains a tag, it's likely a line containging "#" which may turn into a hashtag, so style it as such instead of a header
|
||||||
|
.sb-line-h1:has(> span.sb-hashtag:only-child) {
|
||||||
|
font-size: 1em;
|
||||||
|
padding: 0;
|
||||||
|
font-weight: normal;
|
||||||
|
|
||||||
|
.sb-meta {
|
||||||
|
color: var(--editor-hashtag-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sb-inline-img {
|
.sb-inline-img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue