mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
70.37k stars 6.28k forks source link

export library internal methods #3530

Open lastlink opened 1 year ago

lastlink commented 1 year ago

Would like to use mermaid internals from the npm module such as detectDirective from utils.ts as well as have the parsers exposed in an ala cart mode. So far it only looks like the mermaidAPI.ts methods are exposed.

My purpose is that I'm trying to create an erdiagram to sql exporter and would like to use mermaid js methods directly for serializing a markdown files and extracting models before the svg is generated.

it's looking like I might have to use mermaid.js as a git submodule b/c the methods aren't exposed in the npm package.

I'm having progress breaking out part, currently stuck on the jison lexer (which I believe I could get the erDiagram models that I need for serializing the sql create table statements).

Current Progress: (done)

lastlink commented 1 year ago

maybe related to

2456

nharsch commented 1 year ago

+1

@lastlink I have a similar use case, I'm generating Mermaid ERD diagrams to represent data relationships in CSV files: https://github.com/nharsch/mermaid-erd-generator I'm looking into migrating this from python -> JS (maybe ClojureScript) and using the mermaid library parsers directly in order to getEntities getRelationships, etc. That way I could generate SQL output given an ERD string.