<template>
  <div class="prose prose-indigo dark:prose-invert max-w-none">
    <slot name="content" />
  </div>
</template>

<script setup lang="ts">
import { marked } from 'marked'

const props = defineProps<{
  content: string
}>()

const renderedContent = computed(() => {
  return marked.parse(props.content || '', {
    breaks: true,
    gfm: true,
  })
})
</script>

<style>
.prose {
  max-width: 65ch;
}

.prose pre {
  background-color: #1e1e1e;
  border-radius: 0.5rem;
  overflow-x: auto;
}

.prose code {
  background-color: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.dark .prose code {
  background-color: #374151;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
}

.prose img {
  border-radius: 0.5rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
}

.prose th,
.prose td {
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
}

.dark .prose th,
.dark .prose td {
  border-color: #4b5563;
}

.prose th {
  background-color: #f9fafb;
  font-weight: 600;
}

.dark .prose th {
  background-color: #374151;
}
</style>
