Sign in

    This version of the module is deprecated: Moved; use moonbit-community/mermaid (0.2.0 and later) instead.

    bobzhang/mermaid/config does not have a README file

    ConfigError

    pub(all) suberror ConfigError {
    InvalidColor(String)
    } derive(Eq,
    Debug
    )

    A configuration error.

    Config

    pub struct Config {
    // private fields
    }

    The effective configuration of one diagram: mermaid's defaults, the site configuration and the diagram's own frontmatter and directives, merged the way mermaid.initialize and mermaidAPI.render do.
    impl ToJson for Config

    Config::flag

    fn Config::flag(self : Config, path : String) -> Bool

    Whether the value at path is truthy in the JavaScript sense.

    Config::get

    fn Config::get(self : Config, path : String) -> Json

    The value at a dotted path such as pie.textPosition, or Json::null() when unset.

    Config::new

    fn Config::new(site? : Json, directive? : Json, diagram_type? : String) -> Config raise ConfigError

    Build the configuration for a diagram.

    • site is the configuration an application would pass to mermaid.initialize.
    • directive is the diagram's own configuration: its frontmatter config merged with its %%{init}%% directive.
    • diagram_type scopes theme, look and layout, which a diagram section may set for that diagram type only.

    Config::number

    fn Config::number(self : Config, path : String) -> Double?

    The number at path, if it is one.

    Config::text

    fn Config::text(self : Config, path : String) -> String?

    The string at path, if it is one.

    Config::theme

    The theme variables in effect.

    Config::user_defined

    fn Config::user_defined(self : Config, path : String) -> Json

    The value at a dotted path such as layout as the site configuration and the diagram's directives set it, Json::null() where they leave it to the defaults: mermaid's getUserDefinedConfig.

    assign_with_depth

    fn assign_with_depth(dst : Json, src : Json, depth? : Int) -> Json

    Merge src into dst and return the result, following mermaid's assignWithDepth: objects merge recursively down to depth levels and are shallowly assigned below that; arrays gain the elements they lack; an array merged into an object merges each of its elements in turn. Json::null() plays the role of both undefined and null.

    diagram_config_key

    fn diagram_config_key(diagram_type : String) -> String

    Map a diagram type to the configuration key holding its section.

    evaluate

    fn evaluate(value : Json) -> Bool

    mermaid's evaluate: everything is true except false and the strings false, null and 0.

    sanitize_css

    fn sanitize_css(css : String) -> String

    Reject CSS whose braces do not balance, so a directive cannot close the rule it is placed in.

    sanitize_directive

    fn sanitize_directive(directive : Json) -> Json

    Strip everything from a directive (%%{init: ...}%% or frontmatter config) that is not a known configuration key or looks unsafe.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io