Merge branch 'release_9.2.1_bugfixes' into sidv/webpackTest

* release_9.2.1_bugfixes:
  fix(mermaid): default mermaid back to CommonJS
  fix(mermaid): fix mermaid.render types
This commit is contained in:
Sidharth Vinod 2022-11-07 14:32:35 +05:30
commit 75d276e19e
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
3 changed files with 10 additions and 10 deletions

View File

@ -2,10 +2,10 @@
"name": "mermaid",
"version": "9.2.0",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "./dist/mermaid.core.mjs",
"main": "./dist/mermaid.min.js",
"module": "./dist/mermaid.core.mjs",
"types": "./dist/mermaid.d.ts",
"type": "module",
"type": "commonjs",
"exports": {
".": {
"require": "./dist/mermaid.min.js",

View File

@ -482,9 +482,9 @@ const parseAsync = (txt: string) => {
const renderAsync = (
id: string,
text: string,
cb: (svgCode: string, bindFunctions?: (element: Element) => void) => void,
cb?: (svgCode: string, bindFunctions?: (element: Element) => void) => void,
container?: Element
): Promise<void> => {
): Promise<string> => {
return new Promise((resolve, reject) => {
// This promise will resolve when the mermaidAPI.render call is done.
// It will be queued first and will be executed when it is first in line

View File

@ -115,19 +115,19 @@ export const decodeEntities = function (text: string): string {
*
* @param {string} id The id of the element to be rendered
* @param {string} text The graph definition
* @param {(svgCode: string, bindFunctions?: (element: Element) => void) => void} cb Callback which
* @param cb - Optional callback which
* is called after rendering is finished with the svg code as inparam.
* @param {Element} container Selector to element in which a div with the graph temporarily will be
* inserted. If one is provided a hidden div will be inserted in the body of the page instead. The
* element will be removed when rendering is completed.
* @returns {void}
* @returns Returns the rendered element as a string containing the SVG definition.
*/
const render = function (
id: string,
text: string,
cb: (svgCode: string, bindFunctions?: (element: Element) => void) => void,
cb?: (svgCode: string, bindFunctions?: (element: Element) => void) => void,
container?: Element
): void {
): string {
addDiagrams();
configApi.reset();
text = text.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;;
@ -401,9 +401,9 @@ const render = function (
const renderAsync = async function (
id: string,
text: string,
cb: (svgCode: string, bindFunctions?: (element: Element) => void) => void,
cb?: (svgCode: string, bindFunctions?: (element: Element) => void) => void,
container?: Element
): Promise<void> {
): Promise<string> {
addDiagrams();
configApi.reset();
text = text.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;;