---
title: "Markdown Syntax Example"
date: '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';
import TimeLine from '/src/components/shortcodes/timeline/TimeLine.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.date} updatedDate={frontmatter.updatedDate} />
```mdx
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.date} 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>
```

### Timeline
You can use the `Timeline` component to create a timeline of events or milestones. This is useful for showcasing the history of a project, a series of events, or any other chronological information.

Simply use the `TimeLine` component like this:
```mdx

<TimeLine>
## Date
**Event**
Description of the event.
</TimeLine>
```

<TimeLine>
### October 28, 2011
**"Levels" released**

A track that would become synonymous with the EDM boom of the early 2010s, "Levels" was Avicii's breakout hit. The song's infectious synth riff and the iconic vocal sample from Etta James's "Something's Got a Hold on Me" created a euphoric anthem that catapulted Avicii to international stardom. The idea for the vocal sample reportedly came to him after hearing it in a song by Pretty Lights. Before its official release, "Levels" was already generating significant buzz in the electronic music community, with Avicii teasing it in his live sets. Its release marked a pivotal moment, solidifying Avicii's position as a leading figure in the burgeoning EDM scene and influencing a wave of producers to come.

### June 17, 2013
**"Wake Me Up" released**

In a bold move that would redefine the boundaries of mainstream dance music, Avicii unveiled "Wake Me Up" at the Ultra Music Festival in Miami. The track, a revolutionary blend of country and EDM featuring the soulful vocals of Aloe Blacc and the guitar work of Incubus's Mike Einziger, initially left the festival crowd perplexed. However, this audacious experiment proved to be a stroke of genius. "Wake Me Up" went on to become a global phenomenon, topping charts in numerous countries. The song's lyrics speak of a journey of self-discovery and a desire to live life to the fullest, a theme that resonated deeply with listeners worldwide. The initial negative reaction at Ultra only served to highlight Avicii's forward-thinking approach to music production, proving that taking creative risks could lead to groundbreaking success.

### September 13, 2013
**"True" released**

Following the monumental success of "Wake Me Up," Avicii released his debut studio album, True. The album was a testament to his genre-bending philosophy, further exploring the fusion of electronic music with elements of country, folk, and soul. *True* featured a collection of tracks that would become fan favorites, including the powerful and emotive "Hey Brother." The album showcased Avicii's versatility as a producer, proving that dance music could be both commercially successful and artistically innovative. *True* solidified Avicii's status as a mainstream artist who was not afraid to push creative boundaries.
### October 9, 2013
**"Hey Brother" released**

One of the standout tracks from True, "Hey Brother" featured the distinct bluegrass vocals of Dan Tyminski. The song's lyrics convey a powerful message of camaraderie and unconditional support, themes that struck a chord with a global audience. The fusion of electronic beats with the organic sounds of bluegrass was another example of Avicii's innovative production style. The song's music video, which depicted a story of two brothers during wartime, further amplified its emotional impact.
### December 1, 2014
**"The Nights" released**

Originally released as part of the The Days / Nights EP, "The Nights" is an ode to living a life full of memories and adventure. The song's uplifting melody and anthemic chorus are complemented by lyrics inspired by a poem his father wrote. It’s a heartfelt tribute to his father and the advice he received to live a life he would remember. The track's infectious energy and positive message made it another global hit for Avicii, frequently used in sports montages and celebrations.

### May 22, 2015
**"Waiting for Love" released**

Co-produced with fellow DJ and producer Martin Garrix, "Waiting for Love" is a powerful and emotional track featuring the vocals of Simon Aldred of the British band Cherry Ghost. The song's lyrics explore the pain of loss and the hope of reunion. The accompanying music video, which tells the story of an elderly man embarking on a journey to find his lost wife, added a poignant visual narrative to the song, touching the hearts of many.

### October 2, 2015
**"Stories" released**

Avicii's second studio album, Stories, continued to showcase his musical evolution. The album featured a diverse range of collaborations with artists such as Chris Martin of Coldplay, Wyclef Jean, and Zac Brown Band. With *Stories*, Avicii delved deeper into songwriting and narrative, with each track telling a unique story. The album demonstrated his growth as an artist who was constantly seeking to expand his sonic palette and explore new musical territories.

### June 6, 2019
**"Tim" released**

Following Avicii's tragic passing in April 2018, his family, along with a team of his close collaborators, decided to complete the album he had been working on. The result was Tim, a posthumous album that serves as a poignant and powerful final chapter in his musical legacy. The album features vocals from artists like Aloe Blacc and Chris Martin and touches on themes of love, loss, and self-reflection. The lead single, "SOS," featuring Aloe Blacc, is a raw and honest portrayal of struggling with inner demons. The release of *Tim* was a bittersweet moment for fans, offering a final glimpse into the creative genius of an artist who left the world too soon. All proceeds from the album went to the Tim Bergling Foundation, a charity set up by his family to support mental health awareness.
</TimeLine>

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