This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
bandolier-template/client/components/Markdown.svelte

25 lines
675 B

<script>
import snarkdown from "snarkdown";
export let content = "<b>Markdown:</b> No content? Forgot to #await?";
export let with_p = true;
export let using = snarkdown;
const render = () => {
// the documentation for snarkdown says do NOT use sanitize, read that
// as usual there are timing issues so give some default values
if(with_p && using === snarkdown) {
// weird that snarkdown doesn't do this, or maybe I just don't see the option
return content.split("\n\n").map(line => `<p>${using(line)}</p>`).join("\n");
} else {
return using(content);
}
}
const html = render();
</script>
<div>
{@html html}
</div>