mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 18:20:30 +08:00
Add single line break option to Markdown component
This commit is contained in:
@@ -188,7 +188,7 @@
|
||||
state = "read";
|
||||
}} />
|
||||
{:else}
|
||||
<Markdown {rawPath} content={body} />
|
||||
<Markdown breaks {rawPath} content={body} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
</Radio>
|
||||
{#if preview}
|
||||
<div class="preview">
|
||||
<Markdown {rawPath} content={body} {embeds} />
|
||||
<Markdown breaks {rawPath} {embeds} content={body} />
|
||||
</div>
|
||||
{:else}
|
||||
<input
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -460,6 +460,7 @@
|
||||
{:else if revisionDescription && !first}
|
||||
<div class="revision-description txt-small">
|
||||
<Markdown
|
||||
breaks
|
||||
rawPath={rawPath(revisionBase)}
|
||||
content={revisionDescription} />
|
||||
</div>
|
||||
|
||||
@@ -581,6 +581,7 @@
|
||||
}} />
|
||||
{:else if issue.discussion[0].body}
|
||||
<Markdown
|
||||
breaks
|
||||
content={issue.discussion[0].body}
|
||||
rawPath={rawPath(project.head)} />
|
||||
{:else}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user