mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-24 22:30:35 +08:00
Handle empty string in Markdown component
We expect the `Markdown` component to receive a `content: string`, but we also check if `content` is truthy before rendering anything, and this can get messy when `content` is an empty string. Fixed by removing the truthy check for `content`. Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
+14
-16
@@ -248,21 +248,19 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
{#if content}
|
||||
{#if frontMatter.length > 0}
|
||||
<div class="front-matter">
|
||||
<table>
|
||||
{#each frontMatter as [key, val]}
|
||||
<tr>
|
||||
<td><span class="txt-bold">{key}</span></td>
|
||||
<td>{val}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="markdown" bind:this={container}>
|
||||
{@html render(doc.content)}
|
||||
{#if frontMatter.length > 0}
|
||||
<div class="front-matter">
|
||||
<table>
|
||||
{#each frontMatter as [key, val]}
|
||||
<tr>
|
||||
<td><span class="txt-bold">{key}</span></td>
|
||||
<td>{val}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="markdown" bind:this={container}>
|
||||
{@html render(doc.content)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user