mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-09 17:19:45 +02:00
fix: Remove changes to parse
This commit is contained in:
@@ -30,7 +30,7 @@ export type {
|
|||||||
MermaidConfig,
|
MermaidConfig,
|
||||||
ParseErrorFunction,
|
ParseErrorFunction,
|
||||||
ParseOptions,
|
ParseOptions,
|
||||||
ParseResultWithConfigs as ParseResult,
|
ParseResult,
|
||||||
RenderOptions,
|
RenderOptions,
|
||||||
RenderResult,
|
RenderResult,
|
||||||
SVG,
|
SVG,
|
||||||
@@ -321,12 +321,6 @@ const executeQueue = async () => {
|
|||||||
executionQueueRunning = false;
|
executionQueueRunning = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ParseResultWithConfigs extends Omit<ParseResult, 'config'> {
|
|
||||||
/** Config the user has defined in the text as frontmatter or directives */
|
|
||||||
userConfig: MermaidConfig;
|
|
||||||
defaultConfig: MermaidConfig;
|
|
||||||
config: MermaidConfig;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Parse the text and validate the syntax.
|
* Parse the text and validate the syntax.
|
||||||
* @param text - The mermaid diagram definition.
|
* @param text - The mermaid diagram definition.
|
||||||
@@ -349,20 +343,14 @@ interface ParseResultWithConfigs extends Omit<ParseResult, 'config'> {
|
|||||||
const parse = async (
|
const parse = async (
|
||||||
text: string,
|
text: string,
|
||||||
parseOptions?: ParseOptions
|
parseOptions?: ParseOptions
|
||||||
): Promise<boolean | void | ParseResultWithConfigs> => {
|
): Promise<boolean | void | ParseResult> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// This promise will resolve when the render call is done.
|
// This promise will resolve when the render call is done.
|
||||||
// It will be queued first and will be executed when it is first in line
|
// It will be queued first and will be executed when it is first in line
|
||||||
const performCall = () =>
|
const performCall = () =>
|
||||||
new Promise((res, rej) => {
|
new Promise((res, rej) => {
|
||||||
mermaidAPI.parse(text, parseOptions).then(
|
mermaidAPI.parse(text, parseOptions).then(
|
||||||
(r) => {
|
(result) => {
|
||||||
const result = {
|
|
||||||
diagram: r.diagram,
|
|
||||||
userConfig: r.config,
|
|
||||||
defaultConfig: mermaidAPI.defaultConfig,
|
|
||||||
config: mermaidAPI.getConfig(),
|
|
||||||
} satisfies ParseResultWithConfigs;
|
|
||||||
// This resolves for the promise for the queue handling
|
// This resolves for the promise for the queue handling
|
||||||
res(result);
|
res(result);
|
||||||
// This fulfills the promise sent to the value back to the original caller
|
// This fulfills the promise sent to the value back to the original caller
|
||||||
|
Reference in New Issue
Block a user