Skip to content

@mmd-toolkit/c4-no-duplicate-title ​

Disallow a title statement that replaces a different title set by another title statement.

✅ The recommended configuration enables this rule.

A second title replaces the visible title of the whole diagram. mermaid.js accepts both statements without an error, and the earlier title is lost.

Rule Details ​

This rule applies to C4 diagrams (C4Context, C4Container, C4Component, C4Dynamic, and C4Deployment). It reports a title with a different value from the latest preceding title-setting statement when that statement is also a title. Titles inside boundaries also set the title of the whole diagram. Repeating the same value is not reported. After title First and title Second, a third title First is reported too.

Quotes and whitespace after the first separator are significant, so title "Banking" differs from title Banking. accTitle: is not reported and ends comparison with the preceding title. mermaid.js incorrectly uses this form as a visible title. The rule does not report that accessibility defect as an author mistake.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/c4-no-duplicate-title: error
C4Context
  title Banking
  
title Payments

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/c4-no-duplicate-title: error
C4Context
  title Banking
  title Banking
mmd
%% eslint @mmd-toolkit/c4-no-duplicate-title: error
C4Context
  title Banking
  accTitle: Accessible banking
mmd
%% eslint @mmd-toolkit/c4-no-duplicate-title: error
C4Context
  accTitle: Accessible banking
  title Banking

Options ​

This rule has no options.

Further Reading ​

Version ​

This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.

Resources ​

Third-party tools for Mermaid diagram text.