mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 11:20:36 +08:00
Fix small markdown spacing issue
Adds a listitem renderer overwrite to marked which wraps everything that is inside a <li> which isn't only single <p> tag into a <div class="list-content"> which we give a margin: 1rem 0; Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -250,6 +250,9 @@
|
||||
padding-left: 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.markdown :global(.list-content) {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.markdown :global(li > ul) {
|
||||
margin-bottom: 0rem;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,17 @@ export const renderer = {
|
||||
|
||||
return `<h${level} id="${escapedText}">${text}</h${level}>`;
|
||||
},
|
||||
listitem(text: string) {
|
||||
const hasLineBreaks = text.trim().indexOf("\n");
|
||||
if (hasLineBreaks === -1) {
|
||||
return `<li>${text}</li>`;
|
||||
}
|
||||
const [first, ...remaining] = text.trim().split("\n");
|
||||
const liContent = `${first}<div class="list-content">${remaining.join(
|
||||
"\n",
|
||||
)}</div>`;
|
||||
return `<li>${liContent}</li>`;
|
||||
},
|
||||
};
|
||||
|
||||
export const markdownExtensions = [
|
||||
|
||||
Reference in New Issue
Block a user