MDX is an extended syntax of Markdown that allows the use of JSX syntax within Markdown. For usage, you can refer to rspress MDX.
The rspress
theme provides a majority of the built-in components as global components, which can be used directly in .mdx
files without import, including:
Badge
Card
LinkCard
PackageManagerTabs
Steps
Tab/Tabs
Toc
Other less frequently used components can be imported from @rspress/core/theme
, for example:
doom
provides some global components to assist in document writing, which can be used directly without import. Currently, these include:
Overview
Component for document overview, used to display the document directory.
Directive
Sometimes, due to nested indentation, the custom container syntax may become invalid. The Directive
component can be used as a substitute.
The directory structure of multi-language documents (doc/en
) needs to be fully consistent with the documents under the doc/zh
directory to ensure that the links of multi-language documents are identical except for the language identifier.
If automated translation tools are used for translation, there is no need to
worry about this issue, as the automated translation tools will
automatically generate the directory structure of the target language
documents based on doc/zh
.
ExternalSite
Component to reference external sites.
ExternalSiteLink
Component to reference external site links.
In mdx, <ExternalSiteLink name="connectors" href="link" children="Content" />
has a different meaning from the content below
If you do not want the text to be rendered inside a p
element, you can use the children
attribute as shown in the example above.
AcpApisOverview
andExternalApisOverview
Components to reference external site API overviews.
Term component for plain text, dynamically mounted for injection.
props
name
: Built-in term name, refer to dynamic mounting configuration file.textCase
: Text case transformation, optional values are lower
, upper
, capitalize
.TermsTable
Component for displaying a list of built-in terms.
Name | Chinese | Chinese Bad Cases | English | English Bad Cases | Description |
---|---|---|---|---|---|
company | 灵雀云 | - | Alauda | - | 公司品牌 |
product | 灵雀云容器平台 | - | Alauda Container Platform | - | 产品品牌 |
productShort | ACP | - | ACP | - | 产品品牌简称 |
props
terms
: NormalizedTermItem[]
, optional, a custom term list for reusing when rendering custom terms in internal documentation.JsonViewer
According to conventions, we can extract reusable content to the shared
directory, then import it where needed, for example:
If you need to use more runtime related APIs, you can implement components using .jsx/.tsx
and then import them into .mdx
files.
Note: Currently, components exported from .mdx
do not support passing props
. For scenarios where props
need to be passed, please use .jsx/.tsx
components for development, refer to this issue.