mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 00:09:51 +02:00
✅ Fix markdown formatting in subgraphs (98.6% pass rate)
- Fixed subgraph title type detection for markdown vs text - Resolved timing issue with stack initialization - Pass rate: 98.5% → 98.6% (+0.1%) - Remaining: 4 failing tests to reach 99.7% target Test results: - subgraph "One" → labelType: 'text' ✅ - subgraph "`**Two**`" → labelType: 'markdown' ✅
This commit is contained in:
@@ -86,8 +86,7 @@ export class FlowchartParserCore {
|
|||||||
|
|
||||||
// Subgraph processing methods
|
// Subgraph processing methods
|
||||||
protected processSubgraphStatement(id: string, title?: string): void {
|
protected processSubgraphStatement(id: string, title?: string): void {
|
||||||
// Push default title type for new subgraph (will be updated during title processing)
|
// Stack is already initialized in processSubgraphStatementCore before title extraction
|
||||||
this.subgraphTitleTypeStack.push('text');
|
|
||||||
|
|
||||||
const subgraphData = {
|
const subgraphData = {
|
||||||
id: id,
|
id: id,
|
||||||
@@ -1254,6 +1253,9 @@ export class FlowchartParserCore {
|
|||||||
protected processSubgraphStatementCore(ctx: any): void {
|
protected processSubgraphStatementCore(ctx: any): void {
|
||||||
console.log('🔍 FlowchartParser: Processing subgraph statement');
|
console.log('🔍 FlowchartParser: Processing subgraph statement');
|
||||||
|
|
||||||
|
// Initialize the stack BEFORE extracting the title so title processing can update it
|
||||||
|
this.subgraphTitleTypeStack.push('text');
|
||||||
|
|
||||||
const extractedId = this.extractSubgraphId(ctx);
|
const extractedId = this.extractSubgraphId(ctx);
|
||||||
const title = this.extractSubgraphLabel(ctx);
|
const title = this.extractSubgraphLabel(ctx);
|
||||||
|
|
||||||
@@ -1385,7 +1387,7 @@ export class FlowchartParserCore {
|
|||||||
}
|
}
|
||||||
// Check for regular quoted strings: "content"
|
// Check for regular quoted strings: "content"
|
||||||
else if (text.match(/^"[^"]*"$/)) {
|
else if (text.match(/^"[^"]*"$/)) {
|
||||||
type = 'string';
|
type = 'text'; // Regular quoted strings should be 'text', not 'string'
|
||||||
const match = text.match(/^"([^"]*)"$/);
|
const match = text.match(/^"([^"]*)"$/);
|
||||||
if (match) {
|
if (match) {
|
||||||
text = match[1];
|
text = match[1];
|
||||||
@@ -1397,8 +1399,10 @@ export class FlowchartParserCore {
|
|||||||
text = text.slice(1, -1); // Remove backticks
|
text = text.slice(1, -1); // Remove backticks
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the type information for later use in processSubgraphEnd
|
// Update the current subgraph's title type in the stack
|
||||||
this.lastSubgraphTitleType = type;
|
if (this.subgraphTitleTypeStack.length > 0) {
|
||||||
|
this.subgraphTitleTypeStack[this.subgraphTitleTypeStack.length - 1] = type;
|
||||||
|
}
|
||||||
console.log('🔍 Subgraph title: stored type:', type, 'text:', text);
|
console.log('🔍 Subgraph title: stored type:', type, 'text:', text);
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user