Skip to content

Commit bb69438

Browse files
committed
fix(docs): support boxed Mermaid sequence diagrams
Expose jsdom's Option constructor to the Mermaid linter, which the sequence diagram parser needs to validate box colors. Restore participant label colors on the docs site, where Fern renders boxed sequence diagrams with client-side Mermaid and escapes the child combinator in the generated label styles. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
1 parent a649aa4 commit bb69438

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎fern/main.css‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,3 +1067,11 @@ header[role="banner"] > div[class*="bg-(color:--accent)"][class*="text-(color:--
10671067
opacity: 0;
10681068
}
10691069
}
1070+
1071+
/* Fern renders sequence diagrams that use `box` with client-side Mermaid and
1072+
escapes `>` in Mermaid's generated CSS, so participant labels inherit the
1073+
participant fill. Restore the label color for light and dark modes. */
1074+
.mermaid-container > svg[aria-roledescription="sequence"] text.actor > tspan {
1075+
fill: var(--fg);
1076+
stroke: none;
1077+
}

‎scripts/lint-mermaid/lint-mermaid.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import { JSDOM } from 'jsdom';
3636
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>');
3737
globalThis.window = dom.window;
3838
globalThis.document = dom.window.document;
39+
// Sequence diagram `box` parsing validates colors with `new Option()`.
40+
globalThis.Option = dom.window.Option;
3941

4042
const { default: mermaid } = await import('mermaid');
4143

0 commit comments

Comments
 (0)