Markdown
How to write documents
Introduction
Adalt provides many useful extensions to MDX, a markup language. Here is a brief introduction to the default MDX syntax of Adalt UI.
MDX is not the only supported format of Adalt. In fact, you can use any renderers such as next-mdx-remote
or CMS.
Markdown
We use GFM (GitHub Flavored Markdown), a superset of Markdown (CommonMark). See GFM Specification.
Auto Links
Internal links use the next/link
component to allow prefetching and avoid hard-reload.
External links will get the default rel="noreferrer noopener" target="_blank"
attributes for security.
MDX
MDX is a superset of Markdown, with support of JSX syntax. It allows you to import components, and use them right in the document, or even export values.
see MDX Syntax to learn more.
Cards
Useful for adding links, it is included by default.
Same as normal links, but you can display more information (e.g. icons).
Icon
You can specify an icon to cards.
Callouts
Useful for adding tips/warnings, it is included by default.
Title
Specify a callout title.
Title
Types
You can specify the type of callout.
info
(default)warn
error
Title
Hello World
Customisation
See all MDX components and available options.
Heading Anchors
An anchor is automatically applied to all headings, it sanitizes invalid characters like spaces. (e.g. Hello World
to hello-world
)
Custom Anchor
You can add [#slug]
to customise heading anchors.
To link people to a specific heading, add the heading id to hash fragment: /page#my-heading-id
.
Frontmatter
We support YAML frontmatter. It is a way to specify common information of the document (e.g. title). Place it at the top of document.
See Page Conventions for a list of properties available for frontmatter.
Codeblock
Syntax Highlighting is done with Rehype Code automatically.
You can add a title to the codeblock.
Highlight Lines
You spectify highlighted lines by adding [!code highlight]
.
Highlight Words
You can highlight a specific word by adding [!code word:<match>]
.
As Tab
You can use code block as a <Tab />
component.
Using Typescript Twoslash
Write Typescript codeblocks with hover type information and detected types errors.
Not enabled by default. See Twoslash.
Images
All built-in content sources handle images properly.
Images are automatically optimized for next/image
.
Optional
Some optional plugins you can enable.
Math Equations
Write math equations with TeX.
To enable, see Math Integration.
Package Install
Generate code blocks for installing packages via package managers (JS/Node.js).
To enable, see Remark Install.
More
You can see a list of plugins supported by Adalt.
Last updated on