-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
We have a project where we store markdown data in the database and need to fetch this on the server to then render on the frontend.
Reading the docs the compile function looks to be the way to implement this but as this spits out svelte code wrapped in a string its not possible to render it using `{@render content()} and rendering using {@html content} gives wierd outcomes:
const questionData = {
title: 'Sample Question',
content: `## This is a sample question.
It is used to test the FAQ page when no question is found.
\`\`\`ts
const sample = 'sample';
\`\`\`
`,
slug: 'sample-question'
};
const compiledContent = await compile(questionData.content);

<div class="container">
<div class="prose">
{@html questionData.content.code}
</div>
</div>