MDX
MDX is an extension syntax of Markdown that allows the use of JSX syntax within Markdown. For usage, refer to rspress MDX.
TOC
rspress Componentsdoom ComponentsOverviewCalloutsCalloutDirectiveExternalSiteExternalSiteLinkAcpApisOverview and ExternalApisOverviewTermpropsTermsTablepropsJsonViewerCustom Component Reuserspress Components
Most of the built-in components provided by the rspress theme have been adjusted to global components, which can be used directly in .mdx files without importing, including:
BadgePackageManagerTabsStepsTab/TabsToc
Other less commonly used components can be imported from rspress/theme, for example:
doom Components
doom provides some global components to assist in documentation writing, which can be used directly without importing. Currently, these include:
Overview
Document overview component used to display the document directory
Callouts
Same as the Callouts Markdown extension feature, source code annotation component
- Required for the processes that run in the
virt-launcherpod. - Number of virtual CPUs requested by the virtual machine.
- Number of virtual graphics cards requested by the virtual machine.
- Additional memory overhead:
- If your environment includes a Single Root I/O Virtualization (SR-IOV) network device or a Graphics Processing Unit (GPU), allocate 1 GiB additional memory overhead for each device.
- If Secure Encrypted Virtualization (SEV) is enabled, add 256 MiB.
- If Trusted Platform Module (TPM) is enabled, add 53 MiB.
Callout
Same as the Callout Markdown extension feature, standalone annotation component outside code blocks
1 A- x details of x
- y details of y
Directive
Sometimes, due to nested indentation, the custom container syntax may fail; you can use the Directive component instead
-
The directory structure of multilingual documents (
doc/en) needs to be exactly the same as that under thedoc/zhdirectory to ensure that links in multilingual documents are identical except for the language identifier.NoteIf you are using automated translation tools, you do not need to worry about this issue, as the automated translation tool will automatically generate the target language document directory structure based on
doc/zh.
ExternalSite
External site reference component
ExternalSiteLink
External site link reference component
ContentIn mdx, <ExternalSiteLink name="connectors" href="link" children="Content" /> differs in meaning from the following content
If you do not want the text to be rendered inside a p element, you can pass it via the children prop as shown in the example above.
AcpApisOverview and ExternalApisOverview
External site API overview components
Term
Terminology component, plain text, dynamically mounted and injected
props
name: built-in term name, refer to dynamic mount configuration filetextCase: text case transformation, optional values arelower,upper,capitalize
TermsTable
Built-in terminology list display component
props
terms:NormalizedTermItem[], optional, custom terminology list for convenient reuse when rendering custom terms in internal documents
JsonViewer
Custom Component Reuse
According to the convention, we can extract reusable content into 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 and use them in .mdx files.
Note: Currently, components exported from .mdx do not support passing props. Refer to this issue. Therefore, for scenarios requiring props passing, please develop using .jsx/.tsx components.