主题
配置
【Configuration】
当 Mermaid 启动时,会提取配置以确定用于图表的配置。配置有三种来源:
【When mermaid starts, configuration is extracted to determine a configuration to be used for a diagram. There are 3 sources for configuration:】
- 默认配置
- 站点级别的覆盖由初始化调用设置,并将应用于站点/应用中的所有图表。这个术语称为 siteConfig。
- Frontmatter (v10.5.0+) - 图表作者可以在图表的 frontmatter 中更新选定的配置参数。这些参数会应用到渲染配置中。
- 指令 (已被 Frontmatter 弃用) - 图表作者可以通过指令直接在图表代码中更新选定的配置参数。这些参数会应用到渲染配置中。
渲染配置是指在渲染时使用并应用这些配置的设置。
前言配置
【Frontmatter config】
整个 Mermaid 配置(安全配置除外)可以由图表作者在图表的前置部分覆盖。前置部分是图表顶部的一个 YAML 块。
【The entire mermaid configuration (except the secure configs) can be overridden by the diagram author in the frontmatter of the diagram. The frontmatter is a YAML block at the top of the diagram.】
主题配置
【Theme configuration】
启动 Mermaid
【Starting mermaid】
初始化
【Initialize】
初始化调用只执行一次。它由网站集成者调用,以便在站点级别覆盖默认配置。
【The initialize call is applied only once. It is called by the site integrator in order to override the default configuration at a site level.】
configApi.reset
此方法将图表的配置重置为整体站点配置,即由站点集成商提供的配置。在每次渲染图表之前,重置操作会在最开始被调用。
【This method resets the configuration for a diagram to the overall site configuration, which is the configuration provided by the site integrator. Before each rendering of a diagram, reset is called at the very beginning.】