Add a custom renderer for links, same as in ToastControlelr

This commit is contained in:
Dino Lindlau 2024-02-19 08:44:02 +01:00 committed by Mattias Granlund
parent 5fe888c1b0
commit 16f834fc08

View File

@ -41,6 +41,12 @@
onMount(() => {
laneWidth = lscache.get(laneWidthKey);
});
var renderer = new marked.Renderer();
renderer.link = function (href, title, text) {
if (!title) title = text;
return '<a target="_blank" href="' + href + '" title="' + title + '">' + text + '</a>';
};
</script>
<div class="base">
@ -56,7 +62,7 @@
<div class="card">
<div class="card__header">PR Description</div>
<div class="card__content">
{@html marked.parse(pr.body)}
{@html marked.parse(pr.body, { renderer })}
</div>
</div>
{/if}