callout
This commit is contained in:
parent
5d28e009c9
commit
2ecd06ece9
@ -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}
|
||||
|
@ -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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user