This commit is contained in:
Maxime Cannoodt 2022-06-24 21:28:18 +02:00
parent 5d28e009c9
commit 2ecd06ece9
2 changed files with 5 additions and 11 deletions

View File

@ -3,7 +3,9 @@
export let raw: string;
let isCallout: boolean = raw.split('\n')[0].match(/>\s?\[!(.+)\](\s.*)?/) != null;
let isCallout: boolean = raw.split('\n')[0].match(/>\s?\[!(.+)\](\s.*|$)/) != null;
console.log(raw.split('\n')[0]);
</script>
{#if isCallout}

View File

@ -10,20 +10,12 @@
$: if (content) {
const titleElement = content.getElementsByTagName('p')[0];
console.log(titleElement.innerText.split('\n')[0]);
const match = titleElement.innerText.split('\n')[0].match(/\[!(.+)\](\s([\w\s]+))?/);
console.log(match);
if (match) {
console.log(match.length);
type = match[1];
title = match[2] ?? '';
console.log(title);
type = match[1]?.trim();
title = match[2]?.trim() ?? '';
}
}
// onMount(() => {
// console.log('mounted');
// });
</script>
<div class="border-l-4 border-l-[#448aff] bg-neutral-100 my-4">