callout
This commit is contained in:
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
export let raw: string;
|
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>
|
</script>
|
||||||
|
|
||||||
{#if isCallout}
|
{#if isCallout}
|
||||||
|
|||||||
@@ -10,20 +10,12 @@
|
|||||||
|
|
||||||
$: if (content) {
|
$: if (content) {
|
||||||
const titleElement = content.getElementsByTagName('p')[0];
|
const titleElement = content.getElementsByTagName('p')[0];
|
||||||
console.log(titleElement.innerText.split('\n')[0]);
|
|
||||||
const match = titleElement.innerText.split('\n')[0].match(/\[!(.+)\](\s([\w\s]+))?/);
|
const match = titleElement.innerText.split('\n')[0].match(/\[!(.+)\](\s([\w\s]+))?/);
|
||||||
console.log(match);
|
|
||||||
if (match) {
|
if (match) {
|
||||||
console.log(match.length);
|
type = match[1]?.trim();
|
||||||
type = match[1];
|
title = match[2]?.trim() ?? '';
|
||||||
title = match[2] ?? '';
|
|
||||||
console.log(title);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// onMount(() => {
|
|
||||||
// console.log('mounted');
|
|
||||||
// });
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="border-l-4 border-l-[#448aff] bg-neutral-100 my-4">
|
<div class="border-l-4 border-l-[#448aff] bg-neutral-100 my-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user