mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00
Merge pull request #6855 from mermaid-js/sidv/showRawData
fix: fallback to raw text instead of rendering *Unsupported markdown*
This commit is contained in:
@@ -285,7 +285,11 @@ test('markdownToHTML - Unsupported formatting', () => {
|
||||
- l1
|
||||
- l2
|
||||
- l3`)
|
||||
).toMatchInlineSnapshot('"<p>Hello</p>Unsupported markdown: list"');
|
||||
).toMatchInlineSnapshot(`
|
||||
"<p>Hello</p> - l1
|
||||
- l2
|
||||
- l3"
|
||||
`);
|
||||
});
|
||||
|
||||
test('markdownToHTML - no auto wrapping', () => {
|
||||
|
@@ -3,6 +3,7 @@ import { marked } from 'marked';
|
||||
import { dedent } from 'ts-dedent';
|
||||
import type { MarkdownLine, MarkdownWordType } from './types.js';
|
||||
import type { MermaidConfig } from '../config.type.js';
|
||||
import { log } from '../logger.js';
|
||||
|
||||
/**
|
||||
* @param markdown - markdown to process
|
||||
@@ -61,6 +62,8 @@ export function markdownToLines(markdown: string, config: MermaidConfig = {}): M
|
||||
});
|
||||
} else if (treeNode.type === 'html') {
|
||||
lines[currentLine].push({ content: treeNode.text, type: 'normal' });
|
||||
} else {
|
||||
lines[currentLine].push({ content: treeNode.raw, type: 'normal' });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,7 +92,8 @@ export function markdownToHTML(markdown: string, { markdownAutoWrap }: MermaidCo
|
||||
} else if (node.type === 'escape') {
|
||||
return node.text;
|
||||
}
|
||||
return `Unsupported markdown: ${node.type}`;
|
||||
log.warn(`Unsupported markdown: ${node.type}`);
|
||||
return node.raw;
|
||||
}
|
||||
|
||||
return nodes.map(output).join('');
|
||||
|
Reference in New Issue
Block a user