From d5d025e01134d04e20d3120f273a8765d5855e16 Mon Sep 17 00:00:00 2001 From: grassblock Date: Thu, 12 Jun 2025 20:35:32 +0800 Subject: [PATCH] feat: add ruby helper shortcode --- src/components/shortcodes/Ruby.astro | 6 ++++++ src/content/posts/markdown-example/index.mdx | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/components/shortcodes/Ruby.astro diff --git a/src/components/shortcodes/Ruby.astro b/src/components/shortcodes/Ruby.astro new file mode 100644 index 0000000..2b6f572 --- /dev/null +++ b/src/components/shortcodes/Ruby.astro @@ -0,0 +1,6 @@ +--- +const { text, ruby } = Astro.props; +--- + + {text} ({ruby}) + diff --git a/src/content/posts/markdown-example/index.mdx b/src/content/posts/markdown-example/index.mdx index f75364b..99438d2 100644 --- a/src/content/posts/markdown-example/index.mdx +++ b/src/content/posts/markdown-example/index.mdx @@ -7,6 +7,7 @@ tags: ["markdown", "css", "html", "sample"] import Callout from '/src/components/shortcodes/Callout.astro'; import LinkCard from '/src/components/shortcodes/LinkCard.astro'; import Spoiler from '/src/components/shortcodes/Spoiler.astro'; +import Ruby from '/src/components/shortcodes/Ruby.astro'; This article offers a sample of basic and extended Markdown formatting that can be used, also it shows how some basic HTML elements are decorated. ## Markdown in Astro @@ -52,6 +53,17 @@ You can also display a 'tip' for the reader when hovered: ``` +### Ruby +The `Ruby` component allows you to quickly add ruby annotations to your text, which is useful for providing pronunciation or additional information about certain words, especially in East Asian languages. + + + + +```mdx + + +``` + ### Callouts You can use callouts to highlight important information or warnings in your content. Callouts are styled boxes that draw attention to specific parts of the text. @@ -88,6 +100,9 @@ You can use the `LinkCard` component to create cards that link to external resou Or to customize the card further with a title and description: + + + ## Headings The following HTML `

`—`

` elements represent six levels of section headings. `

` is the highest section level while `

` is the lowest.