When rendering/layout is affected by configuration or theming, avoid magic numbers and ad-hoc config handling. Instead:
"false" the same as false).themeVariables (or CSS vars like --mermaid-font-family) rather than hard-coding constants that break with different fonts/sizes.Example pattern:
// config.js
export function getEffectiveFlowchartHtmlLabels(siteConfig) {
// Correctly coerce string booleans
const v = siteConfig?.flowchart?.htmlLabels;
return v === true || v === 'true';
}
And for theme-derived styling:
// instead of spacing = 60; or font-family: ${options.fontFamily};
const spacing = themeVariables?.noteSpacing ?? 60; // or derive from other theme vars
const fontFamily = 'var(--mermaid-font-family), trebuchet ms, verdana, arial, sans-serif';
Enter the URL of a public GitHub repository