---
title: "Markdown Syntax Example"
pubDate: '2023-07-15T12:00:00Z'
description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements."
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';
import ProtectedContent from '/src/components/shortcodes/ProtectedContent.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
> [Markdown](https://daringfireball.net/projects/markdown/) is commonly used to author text-heavy content like blog posts and documentation. Astro includes built-in support for Markdown files that can also include [frontmatter YAML](https://dev.to/paulasantamaria/introduction-to-yaml-125f) (or [TOML](https://toml.io)) to define custom properties such as a title, description, and tags.
>
> In Astro, you can author content in [GitHub Flavored Markdown](https://github.github.com/gfm/), then render it in `.astro` components. This combines a familiar writing format designed for content with the flexibility of Astro’s component syntax and architecture.

source: [Markdown in Astro | Docs](https://docs.astro.build/en/guides/markdown-content/)

## Theme Specifics
This theme came with a set of shortcodes that can be used to enhance the Markdown experience. These shortcodes are located in the `/src/components/shortcodes` directory and can be used to add custom functionality or styling to your Markdown content.

To use these shortcodes, you should first rename the file to a MDX (.mdx) file. Once renamed, you can use the shortcodes in your content like this:

```mdx
import ExampleShortcode from '/src/components/shortcodes/ExampleShortcode.astro';

your content here...
</ExampleShortcode>
```

### Spoiler
Inspired by the spoiler in [Moegirl wiki](https://zh.moegirl.org.cn/Mainpage), you can use the `Spoiler` component to hide content that you want to reveal later. This is useful for spoilers in game plots , movies plots, or any other content where you want to keep certain information hidden until the user chooses to reveal it.

To reveal the content, readers can hover over the text to reveal it.
<Spoiler>
    A hot take: the theme is done through what is called 'vibe coding'.
</Spoiler>

```mdx
<Spoiler>
    A hot take: the theme is done through what is called 'vibe coding'.
</Spoiler>
```
You can also display a 'tip' for the reader when hovered:
<Spoiler tip='attention is all you need'>
    A hot take: the theme is done through what is called 'vibe coding'.
</Spoiler>

```mdx
<Spoiler tip='attention is all you need'>
    A hot take: the theme is done through what is called 'vibe coding'.
</Spoiler>
```

### 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.

<Ruby text="汉" ruby="han" />
<Ruby text="字" ruby="zi" />

```mdx
<Ruby text="汉" ruby="han" />
<Ruby text="字" ruby="zi" />
```

### 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.
<Callout icon='💁' type="info">
    This is an informational callout. It can be used to provide additional context or tips.
</Callout>
<Callout type="warning">
    This is a warning callout. Use it to alert users about potential issues or important notes.
</Callout>
<Callout type="danger">
    This is an error callout. It should be used to indicate critical issues that need immediate attention.
</Callout>

```mdx
<Callout icon='💁' type="info">
  This is an informational callout. It can be used to provide additional context or tips.
</Callout>
<Callout type="warning">
  This is a warning callout. Use it to alert users about potential issues or important notes.
</Callout>
<Callout type="danger">
  This is an error callout. It should be used to indicate critical issues that need immediate attention.
</Callout>
```
### LinkCard
You can use the `LinkCard` component to create cards that link to external resources or pages. This is useful for showcasing projects, documentation, or any other relevant links.

This most simple one can be used like this:
<LinkCard url="https://astro.build"/>
```mdx
<LinkCard url="https://astro.build"/>
```
or with a archive link:
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.pubDate} updatedDate={frontmatter.updatedDate} />
```mdx
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.pubDate} updatedDate={frontmatter.updatedDate} />
```
<Callout type="info">
    The `pubDate` or `updatedDate` props is optional, but in order to make the component to display the archived version around the date correctly, they should be passed.

    Choose one or both of them according to your needs.
</Callout>
<Callout type="warning">
    On a machine with bad network, this will significantly increase build time when no other params are passed to the component.
</Callout>
Or to customize the card further with a title and description:
<LinkCard url="https://www.bilibili.com/video/BV1PC4y1L7mq/" title="Don't check the description" description="Don't click on the link" />

### Protected Content
You can use the `ProtectedContent` component to protect certain parts of your content with a password. This is useful for sharing exclusive content or information that should only be accessible to certain users.
<Callout type="warning">
About security:

    Although the encrypt process is happened at build and encrypted content is not visible in the rendered HTML. But it's still not 100% secure, as the password can be stored in the source code of a document (which could be public). Use it only for not really sensitive content.
    Using a environment variable to store the password is recommended.
</Callout>

<ProtectedContent password="42">
    Yes, what you input is the ultimate answer to *life*, *the universe*, and **everything**.
</ProtectedContent>

```mdx
<ProtectedContent password="42">
    Yes, what you input is the ultimate answer to *life*, *the universe*, and **everything**.
</ProtectedContent>
```

<ProtectedContent>
    And this will be encrypted with a global password, which is set in the environment variable `CONTENT_PASSWORD` or defined by `config.ts`. (config.ts takes precedence over the environment variable)
</ProtectedContent>

```mdx
<ProtectedContent>
   And this will be encrypted with a global password, which is set in the environment variable `CONTENT_PASSWORD` or defined by `config.ts`. (config.ts takes precedence over the environment variable)
</ProtectedContent>
```

## Headings

The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.

# H1

## H2

### H3

#### H4

##### H5

###### H6

## Paragraph

Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.

Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.

## Blockquotes

The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations.

### Blockquote without attribution

> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
> **Note** that you can use _Markdown syntax_ within a blockquote.

### Blockquote with attribution

> Don't communicate by sharing memory, share memory by communicating.<br/>
> — <cite>Rob Pike[^1]</cite>

[^1]: The above quote is excerpted from Rob Pike's [talk `about` nothing](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.

## Tables

Tables aren't part of the core Markdown spec, but Astro supports supports them out-of-the-box.

| Name  | Age |
| ----- | --- |
| Bob   | 27  |
| Alice | 23  |

### Inline Markdown within tables

| Italics   | Bold     | Code   |
| --------- | -------- | ------ |
| _italics_ | **bold** | `code` |

## Code Blocks

### Code block with backticks

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Example HTML5 Document</title>
  </head>
  <body>
    <p>Test</p>
  </body>
</html>
```


## List Types

### Ordered List

1. First item
2. Second item
3. Third item

### Unordered List

- List item
- Another item
- And another item

### Nested list

- Fruit
    - Apple
    - Orange
    - Banana
- Dairy
    - Milk
    - Cheese

## Other Elements — abbr, sub, sup, kbd, mark

<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.

H<sub>2</sub>O

X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>

Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.

Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.

### Formulas
Thanks to the [remark-math](https://github.com/remarkjs/remark-math) and [KaTeX](https://katex.org/) , you can write mathematical formulas using LaTeX syntax.

Both inline and block formulas are supported (see example below). Inline formulas can be written like `$$L$$` or `$L$`,

while block formulas can be written like this:

```latex
$$
-\frac{\hbar^2}{2m}\nabla^2\psi + V\psi = E\psi
$$
```

or

````markdown
```math
-\frac{\hbar^2}{2m}\nabla^2\psi + V\psi = E\psi
```
````

By default, the reader can copy the formulas in LaTeX format by copy the rendered formulas, unless you set `noClientJavaScript` to `true` in the `config.ts` file.


Lift($$L$$) can be determined by Lift Coefficient ($$C_L$$) like the following
equation:

$$
L = \frac{1}{2} \rho v^2 S C_L
$$