diff --git a/src/components/shortcodes/Callout.astro b/src/components/shortcodes/Callout.astro index 9617c89..8886a7f 100644 --- a/src/components/shortcodes/Callout.astro +++ b/src/components/shortcodes/Callout.astro @@ -31,6 +31,11 @@ const { icon, type = 'info'} = Astro.props; --callout-text: #2e3440; } + .callout-tip { + --callout-bg: var(--secondary-color); + --callout-text: #2e3440; + } + .callout-warning { --callout-bg: var(--terminal-yellow); --callout-text: #2e3440; diff --git a/src/components/shortcodes/timeline/TimeLine.astro b/src/components/shortcodes/timeline/TimeLine.astro index 99b6cda..4e9dac0 100644 --- a/src/components/shortcodes/timeline/TimeLine.astro +++ b/src/components/shortcodes/timeline/TimeLine.astro @@ -15,8 +15,14 @@ import TimeLineItem from "./TimeLineItem.astro"; import { parse } from "ultrahtml"; import {querySelectorAll} from 'ultrahtml/selector' +interface TimelineItem { + date: string; + title: string; + descriptionHTML: string; +} + /* These code has a lot of children LoL */ -function parseTimeLineContent(content: string) { +function parseTimeLineContent(content: string): TimelineItem[] { if (!content) return []; const html = parse(content); @@ -47,18 +53,24 @@ function parseTimeLineContent(content: string) { return items; } -const renderedHTML = await Astro.slots.render('default'); -const timelineItems = parseTimeLineContent(renderedHTML); +let timelineItems: TimelineItem[] = [] +const { parseFromText = true } = Astro.props; + +if (parseFromText) { + const renderedHTML = await Astro.slots.render('default'); + timelineItems = parseTimeLineContent(renderedHTML); +} ---