English
@mmd-toolkit/flowchart-no-duplicate-title
Disallow an accTitle statement that sets the title again.
✅ The recommended configuration enables this rule.
💡 This rule is manually fixable by editor suggestions.
A diagram has one accessible title. When another accTitle statement sets it, mermaid.js replaces the earlier title without an error, so the earlier one is lost.
Rule Details
This rule applies to flowcharts (flowchart, graph, flowchart-elk, and swimlane-beta). It reports an accTitle statement that changes a title set by an earlier statement. Statements inside a subgraph set the title of the whole diagram and count too.
With no text after accTitle:, the next line with text supplies the title, past empty lines, comment lines, and directives; with no such line, the title becomes empty.
Repeating the current title is not reported, while going back to an earlier one is: after accTitle: a and accTitle: b, a third accTitle: a is reported. Titles are compared without whitespace at their ends.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-title: error
flowchart LR
accTitle: first
accTitle: secondmmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-title: error
flowchart LR
A
accTitle: x
accTitle:mmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-title: error
flowchart LR
subgraph S
A
accTitle: inner
end
accTitle: outerExamples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-title: error
flowchart LR
A
accTitle: firstmmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-title: error
flowchart LR
A
accTitle: first
accTitle: firstOptions
This rule has no options.
Related Rules
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.