Skip to content

Commit

Permalink
Fix markdown logic (fixes #190) (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
Iinh authored Nov 12, 2020
1 parent 4580911 commit 338872e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
12 changes: 4 additions & 8 deletions src/components/Markdown.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<script>
import marked from "marked";
let markdown;
export let text = "";
export let text;
</script>

{#if markdown}
{@html marked.parseInline(markdown.textContent)}
{/if}
<div class="raw-markdown hidden" bind:this={markdown}>
<slot>{text}</slot>
</div>
<slot>
{@html marked.parseInline(text)}
</slot>
8 changes: 2 additions & 6 deletions src/pages/AppDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@
{#each filteredPings as ping}
<li>
<a href={`/apps/${app.name}/pings/${ping.name}`}>{ping.name}</a>
<i>
<Markdown>{ping.description}</Markdown>
</i>
<i><Markdown text={ping.description} /></i>
</li>
{:else}
<p>Your search didn't match any ping.</p>
Expand All @@ -114,9 +112,7 @@
<li>
<a
href={`/apps/${params.app}/metrics/${metric.name}`}>{metric.name}</a>
<i>
<Markdown>{metric.description}</Markdown>
</i>
<i><Markdown text={metric.description} /></i>
</li>
{:else}
<p>Your search didn't match any metric.</p>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MetricDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
{#await metricDataPromise then metric}
<h1>{metric.name}</h1>
<p>
<Markdown>{metric.description}</Markdown>
<Markdown text={metric.description} />
</p>
<p>
<a
Expand Down
4 changes: 2 additions & 2 deletions src/pages/PingDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tr>
<td>Description</td>
<td>
<Markdown>{ping.description}</Markdown>
<Markdown text={ping.description} />
</td>
</tr>
<tr>
Expand Down Expand Up @@ -77,7 +77,7 @@
<li>
<a href={`/apps/${params.app}/metrics/${metric.name}`}>{metric.name}</a>
<i>
<Markdown>{metric.description}</Markdown>
<Markdown text={metric.description} />
</i>
</li>
{/each}
Expand Down

0 comments on commit 338872e

Please sign in to comment.