Authoring Content in Markdown
यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।
Starlight supports the full range of Markdown syntax in .md
files as well as frontmatter YAML to define metadata such as a title and description.
Please be sure to check the MDX docs or Markdoc docs if using those file formats, as Markdown support and usage can differ.
Frontmatter
You can customize individual pages in Starlight by setting values in their frontmatter.
Frontmatter is set at the top of your files between ---
separators:
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.
You can link to another page.
You can highlight inline code
with backticks.
Images
Images in Starlight 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.
Relative image paths are also supported for images stored locally in your project.
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 Starlight
Starlight 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:
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:
Level 2 (<h2>
) and Level 3 (<h3>
) headings will automatically appear in the page table of contents.
Learn more about how Astro processes heading id
s in the Astro Documentation
Asides
Asides (also known as “admonitions” or “callouts”) are useful for displaying secondary information alongside a page’s main content.
Starlight provides a custom Markdown syntax for rendering asides. Aside blocks are indicated using a pair of triple colons :::
to wrap your content, and can be of type note
, tip
, caution
or danger
.
You can nest any other Markdown content types inside an aside, but asides are best suited to short and concise chunks of content.
Note aside
Custom aside titles
You can specify a custom title for the aside in square brackets following the aside type, e.g. :::tip[Did you know?]
.
More aside types
Caution and danger asides are helpful for drawing a user’s attention to details that may trip them up. If you find yourself using these a lot, it may also be a sign that the thing you are documenting could benefit from being redesigned.
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.
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.
Expressive Code features
Starlight uses Expressive Code to extend formatting possibilities for code blocks.
Expressive Code’s text markers and window frames plugins are enabled by default.
Code block rendering can be configured using Starlight’s expressiveCode
configuration option.
Text markers
You can highlight specific lines or parts of your code blocks using Expressive Code text markers on the opening line of your code block.
Use curly braces ({ }
) to highlight entire lines, and quotation marks to highlight strings of text.
There are three highlighting styles: neutral for calling attention to code, green for indicating inserted code, and red for indicating deleted code.
Both text and entire lines can be marked using the default marker, or in combination with ins=
and del=
to produce the desired highlighting.
Expressive Code provides several options for customizing the visual appearance of your code samples. Many of these can be combined, for highly illustrative code samples. Please explore the Expressive Code documentation for the extensive options available. Some of the most common examples are shown below:
Frames and titles
Code blocks can be rendered inside a window-like frame.
A frame that looks like a terminal window will be used for shell scripting languages (e.g. bash
or sh
).
Other languages display inside a code editor-style frame if they include a title.
A code block’s optional title can be set either with a title="..."
attribute following the code block’s opening backticks and language identifier, or with a file name comment in the first lines of the code.
Other common Markdown features
Starlight 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.
Advanced Markdown and MDX configuration
Starlight uses Astro’s Markdown and MDX renderer built on remark and rehype. You can add support for custom syntax and behavior by adding remarkPlugins
or rehypePlugins
in your Astro config file. See “Configuring Markdown and MDX” in the Astro docs to learn more.