/var/log/mercury/blog/markdown-example/
search

Markdown Syntax Example

| 2023-07-15 (Updated on 2025-08-09) | 2037 words
Table of Contents

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 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 (or TOML) to define custom properties such as a title, description, and tags.

In Astro, you can author content in GitHub Flavored Markdown, 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

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:

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

your content here...
</ExampleShortcode>

Spoiler

Inspired by the spoiler in Moegirl wiki, 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.

A hot take: the theme is done through what is called ‘vibe coding’.

<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:

A hot take: the theme is done through what is called ‘vibe coding’.

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

(han) (zi)
<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.

💁

This is an informational callout. It can be used to provide additional context or tips.

This is a warning callout. Use it to alert users about potential issues or important notes.

This is an error callout. It should be used to indicate critical issues that need immediate attention.

<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"/>

or with a archive link:

<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.pubDate} updatedDate={frontmatter.updatedDate} />

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.

On a machine with bad network, this will significantly increase build time when no other params are passed to the component.

Or to customize the card further with a title and description:

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.

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.

This content is protected. Enter the password to view it:

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

This content is protected. Enter the password to view it:

<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:


<TimeLine>
## Date
**Event**
Description of the event.
</TimeLine>
  1. 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.

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

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

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

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

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

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

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

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.
Rob Pike1

Tables

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

NameAge
Bob27
Alice23

Inline Markdown within tables

ItalicsBoldCode
italicsboldcode

Code Blocks

Code block with backticks

<!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

GIF is a bitmap image format.

H2O

Xn + Yn = Zn

Press CTRL+ALT+Delete to end the session.

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.

Formulas

Thanks to the remark-math and KaTeX , 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:

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

or

```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(LL) can be determined by Lift Coefficient (CLC_L) like the following equation:

L=12ρv2SCLL = \frac{1}{2} \rho v^2 S C_L

Footnotes

  1. The above quote is excerpted from Rob Pike’s talk about nothing during Gopherfest, November 18, 2015.

↩ Reply via Email
← Back to posts

Comments