Move markdown to molecules

main
trivernis 3 months ago
parent 7a254da0ae
commit 20edd1b562
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -1,13 +0,0 @@
<script lang="ts">
import { marked } from "marked";
type Props = {
markdown: string;
};
const { markdown }: Props = $props();
const markdownHtml = marked(markdown);
</script>
{@html markdownHtml}

@ -1,20 +1,22 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { marked } from "marked";
type Props = {
children: Snippet;
markdown: string;
};
const { children }: Props = $props();
const { markdown }: Props = $props();
const markdownHtml = marked(markdown);
</script>
<div class="paragraph">
{@render children()}
<div class="markdown">
{@html markdownHtml}
</div>
<style lang="scss">
@layer component {
.paragraph {
.markdown {
font-family: var(--font-readable);
hyphens: auto;
text-align: justify;

@ -2,8 +2,7 @@
import type { BlogPostContentEntry } from "$lib/cms/blog";
import "$lib/vars.scss";
import Box from "../atoms/Box.svelte";
import Markdown from "../atoms/Markdown.svelte";
import Paragraph from "../atoms/Paragraph.svelte";
import Markdown from "../molecules/Markdown.svelte";
import Image from "../molecules/Image.svelte";
type Props = {
@ -17,15 +16,11 @@
{#if content.__component === "content.text-markdown"}
{#if content.type === "paragraph"}
<Box>
<Paragraph>
<Markdown markdown={content.value} />
</Paragraph>
</Box>
{:else if content.type === "infobox"}
<Box color="cyan" title="Info">
<Paragraph>
<Markdown markdown={content.value} />
</Paragraph>
</Box>
{/if}
{:else if content.__component === "content.image"}

Loading…
Cancel
Save