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:
Sebastian Martinez
2022-10-28 11:05:13 +02:00
parent 87c1d0f6e2
commit c757f8df8b
+14 -16
View File
@@ -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>