mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
feat: improve documentation
This commit is contained in:
parent
51c6462f1d
commit
649e6820cc
@ -7,6 +7,11 @@ import { UnknownDiagramError } from './errors';
|
|||||||
import { DetailedError } from './utils';
|
import { DetailedError } from './utils';
|
||||||
|
|
||||||
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object representing a parsed mermaid diagram definition.
|
||||||
|
* @privateRemarks This is exported as part of the public mermaidAPI.
|
||||||
|
*/
|
||||||
export class Diagram {
|
export class Diagram {
|
||||||
type = 'graph';
|
type = 'graph';
|
||||||
parser;
|
parser;
|
||||||
@ -68,6 +73,15 @@ export class Diagram {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the text asynchronously and generate a Diagram object asynchronously.
|
||||||
|
* **Warning:** This function may be changed in the future.
|
||||||
|
* @alpha
|
||||||
|
* @param text - The mermaid diagram definition.
|
||||||
|
* @returns A the Promise of a Diagram object.
|
||||||
|
* @throws {@link UnknownDiagramError} if the diagram type can not be found.
|
||||||
|
* @privateRemarks This is exported as part of the public mermaidAPI.
|
||||||
|
*/
|
||||||
export const getDiagramFromText = async (text: string): Promise<Diagram> => {
|
export const getDiagramFromText = async (text: string): Promise<Diagram> => {
|
||||||
const type = detectType(text, configApi.getConfig());
|
const type = detectType(text, configApi.getConfig());
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user