Add single line break option to Markdown component

This commit is contained in:
Sebastian Martinez
2024-03-25 17:43:45 +01:00
committed by Rūdolfs Ošiņš
parent 89ea5f904f
commit 4cbc6222c1
7 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -188,7 +188,7 @@
state = "read";
}} />
{:else}
<Markdown {rawPath} content={body} />
<Markdown breaks {rawPath} content={body} />
{/if}
</div>
{/if}
+1 -1
View File
@@ -193,7 +193,7 @@
</Radio>
{#if preview}
<div class="preview">
<Markdown {rawPath} content={body} {embeds} />
<Markdown breaks {rawPath} {embeds} content={body} />
</div>
{:else}
<input
+3
View File
@@ -29,6 +29,8 @@
// If present, means we are in a preview context,
// use this for image previews instead of /raw URLs.
export let embeds: Map<string, Embed> | undefined = undefined;
// If true, add <br> on a single line break
export let breaks: boolean = false;
let container: HTMLElement;
let frontMatter: [string, any][] | undefined = undefined;
@@ -93,6 +95,7 @@
return dompurify.sanitize(
markdown.parse(content, {
renderer: new Renderer(linkBaseUrl, false),
breaks,
}) as string,
);
}
+1
View File
@@ -460,6 +460,7 @@
{:else if revisionDescription && !first}
<div class="revision-description txt-small">
<Markdown
breaks
rawPath={rawPath(revisionBase)}
content={revisionDescription} />
</div>
+1
View File
@@ -581,6 +581,7 @@
}} />
{:else if issue.discussion[0].body}
<Markdown
breaks
content={issue.discussion[0].body}
rawPath={rawPath(project.head)} />
{:else}
+4 -1
View File
@@ -821,7 +821,10 @@
}
}} />
{:else if description}
<Markdown content={description} rawPath={rawPath(patch.id)} />
<Markdown
breaks
content={description}
rawPath={rawPath(patch.id)} />
{:else}
<span class="txt-missing">No description available</span>
{/if}
+1 -1
View File
@@ -217,7 +217,7 @@
{:else if preview && blob.content}
{#if isMarkdown}
<div style:padding="2rem">
<Markdown {linkBaseUrl} content={blob.content} {rawPath} {path} />
<Markdown {rawPath} {path} {linkBaseUrl} content={blob.content} />
</div>
{:else if isSvg}
<div style:margin="1rem 0" style:text-align="center">