Authoring Content in Markdown
CelestialDocs supports the full range of Markdown syntax in .md
files as well as frontmatter YAML to define metadata such as a tilte and description.
Frontmatter
You can modify individual pages in CelestialDocs by setting values in their fromtmatter. Frontmetter is set at the top of your files between ---
separators.
---
title: Sample
---
Page content goes here, after `---`.
Every page must include at least a title
. See the frontmatter reference for all available fields and how to add custom fields.
Inline styles
Text can be bold, italic or strikethrough.
Text can be **bold**, _italic_ or ~~strikethrough~~.
You can link to another page.
You can [link to another page](/getting-started).
You can highlight inline code
with backticks.
You can highlight `inline code` with backticks.
Images
Images in CelestialDocs use Astro’s built-in optimized asset support.
Markdown and MDX support the Markdown syntax for displaying images that includes alt-text for screen readers and assistive technology.
![An illustration of planets and stars featuring the word “astro”](https://raw.githubusercontent.com/withastro/docs/main/public/default-og-image.png)
Relative image paths are also supported for images stored locally in your project.
![A kitty in space](../../../assets/KittyAstronaut.svg)
Headings
You can structure content using a heading. Headings in Markdown are indicated by a number of # at the start of the line.
How to structure page content in CelestialDocs
CelestialDocs is configured to automatically use your page title as a top-level heading and will include an “Overview” heading at top of each page’s table of contents. We recommend starting each page with regular paragraph text content and using on-page headings from <h2>
and down:
---
title: Markdown Guide
description: How to use Markdown in CelestialDocs
---
This page describes how to use Markdown in CelestialDocs.
## Inline Styles
## Headings
Automatic heading anchor links
Using headings in Markdown will automatically give you anchor links so you can link directly to certain sections of your page:
---
title: My page of content
description: How to use CelestialDocs's built-in anchor links
---
## Introduction
I can link to [my conclusion](#conclusion) lower on the same page.
## Conclusion
`https://my-site.com/page1/#introduction` navigates directly to my Introduction.
Level 2 (<h2>
) and Level 3 (<h3>
) headings will automatically appear in the page table of contents.
Learn more about how Astro processes heading ids in the Astro Documentation.
Blockquotes
This is a blockquote, which is commonly used when quoting another person or document.
Blockquotes are indicated by a
>
at the start of each line.
> This is a blockquote, which is commonly used when quoting another person or document.
>
> Blockquotes are indicated by a `>` at the start of each line.
Code blocks
A code block is indicated by a block with three backticks ``` at the start and end. You can indicate the programming language being used after the opening backticks.
// Javascript code with syntax highlighting.
var fun = function lang(l) {
dateformat.i18n = require('./lang/' + l);
return true;
};
```js
// Javascript code with syntax highlighting.
var fun = function lang(l) {
dateformat.i18n = require('./lang/' + l);
return true;
};
```
Details
Details (also known as “disclosures” or “accordions”) are useful to hide content that is not immediately relevant. Users can click a short summary to expand and view the full content.
Use the standard HTML <details>
and <summary>
elements in your Markdown content to create a disclosure widget.
You can nest any other Markdown syntax inside a <details>
element.
Where and when is the Andromeda constellation most visible?
The Andromeda constellation is most visible in the night sky during the month of November at latitudes between +90°
and -40°
.
<details>
<summary>Where and when is the Andromeda constellation most visible?</summary>
The [Andromeda constellation](<https://en.wikipedia.org/wiki/Andromeda_(constellation)>) is most visible in the night sky during the month of November at latitudes between `+90°` and `-40°`.
</details>
Other common Markdown features
CelestialDocs supports all other Markdown authoring syntax, such as lists and tables. See the Markdown Cheat Sheet from The Markdown Guide for a quick overview of all the Markdown syntax elements.