Comments (17)
https://mermaidjs.github.io/sequenceDiagram.html says
Is it possible to adjust the margins for rendering the sequence diagram.
This is done by defining mermaid.sequenceConfig or by the CLI to use a json file with the configuration. How to use the CLI is described in the mermaidCLI page.
but the new CLI tool project doesn't expose a way to pass in the config object/json. I currently depend on the CLI tool to call mermaid (not using the api).
Will check later if the cli has an undocumented arg to give a config json.
from mermaid-filter.
I opened mermaidjs/mermaid.cli#9 in order to track it.
from mermaid-filter.
Version 0.3.1 of mermaid.cli now supports configuration via json file (and css file for extra config!)
from mermaid-filter.
Great... How do you think this should be supported on mermaid-filter? We could do additional options on the mermaid class - but this means that every diagram on the markdown file needs the class to be specified.
Also, reduces portability - for ex if you render on a different machine where the config files arent available.
I think having .mermaid-filter-config.json
and .mermaid-filter.css
files in the folder from where pandoc is run might be better?
Thoughts?
from mermaid-filter.
Mmmm, thinking aloud here.
I'm not sure if having the config files where the pandoc binary is run is a good idea. I guess it would be ok if a default configuration set of files was installed in the right place when doing the npm install --global mermaid-filter
Another option would be having a couple of vscode configuration entries pointing to where the mermaid-filter-config.json and .css are. This would allow you to have self-contained pandoc projects, with the configuration files in it. In case these configuration entries are empty, you could have the pandoc directory as default...
Any of these would make all your diagrams render the same way, or at least all your project diagrams (since vscode config can change at the project level, right?), but I think this could be an acceptable compromise.
from mermaid-filter.
Another option would be having a couple of vscode configuration entries pointing to where the mermaid-filter-config.json and .css are. This would allow you to have self-contained pandoc projects, with the configuration files in it. In case these configuration entries are empty, you could have the pandoc directory as default...
I don't want to tie mermaid-filter to vscode specific configuration (though I'm not sure if that's what you mean)
What I meant is that if you have ~/folderA which has a bunch of markdown files, and assuming most people run pandoc inside ~/folderA, then look for the default config files in folderA - which seems pretty much what you're suggesting in the latter part.
from mermaid-filter.
I don't want to tie mermaid-filter to vscode specific configuration (though I'm not sure if that's what you mean)
Yes, that's what I meant, and you are completely right. The filter should stand on its own. Forget what I said about vscode.
What I meant is that if you have ~/folderA which has a bunch of markdown files, and assuming most people run pandoc inside ~/folderA, then look for the default config files in folderA - which seems pretty much what you're suggesting in the latter part.
Sounds reasonable. I'd go for this one.
Can filters receive parameters to specify alternate locations?
from mermaid-filter.
I just pushed a branch - jsonconfig - can you pull from there and give it a go?
Can filters receive parameters to specify alternate locations?
AFAICR, not if you specify the the filtername as -F
to pandoc. You have to write out the entire command like
pandoc -t json -i somefile.md | node index.js -opta --opt | pandoc -t html -o whatever.html
and that's quite cumbersome.
You could wrap the filter command in a batch/shell script and then call pandoc of course... that should work
from mermaid-filter.
Certainly.
After I grab the jsonconfig branch, any recommendation on how to install the devel version so that I can use it as a filter for pandoc?
from mermaid-filter.
you can install it with npm - like so
user/project#branch
- so npm i -g raghur/mermaid-filter#jsonconfig
from mermaid-filter.
Thanks!
Testing...
I'll update this post after the tests.
UPDATE
It seems to be working great!
I tested conversion to docx with and without the config files and it worked as expected.
I also tested converting a .md
file in a subdirectory and it went well also.
I'd like to test it also with pandocomatic but I'm sure it will go fine also
from mermaid-filter.
Pandocomatic works fine also.
I must say this is a fantastic improvement, I will finally be able to use mermaid for generating docx documents, and have them look great.
from mermaid-filter.
Now that I review mermaid.cli, the only thing that is missing is the --theme
option (the background one can be simulated with the css config).
Maybe the theme option can also be replicated with the css+json config, but it would be nice to have it also in the filter.
Should I open a separate issue for it?
from mermaid-filter.
Just pushed to jsonconfig branch with support for --theme
. README has been updated as well - so take a look there.
from mermaid-filter.
It works great!
It has even allowed me to find a couple of bugs in mermaid.cli (I made a new PR there to fix them mermaidjs/mermaid.cli#21 )
Thanks @raghur
from mermaid-filter.
Great... thanks for testing. Have merged and pushed out v1.1.0 to npm
from mermaid-filter.
Only one question.
The PR above is trying to fix mermaid.cli when no theme is specified in the commandline, but a theme is present in the json config (right now default theme is always used).
I fear the same would happen in this filter.
Would it be possible to only specify -t default
if the theme was explicitly entered as an attribute to the figure?
It could be done by setting a default value different from "default" (like "theme-default") and only issuing the -t
commandline when the value was different from this "theme-default".
I was writing this as you closed the issue.
No worries, we could revisit this if/when my PR is merged in mermaid.cli
Thanks for pushing 1.1.0 !!!!
from mermaid-filter.
Related Issues (20)
- list of options? HOT 1
- can we place nodes relative to each other? HOT 1
- Publishing a new NPM release HOT 1
- Please upgrade to mermaid-cli v9 HOT 4
- Allow embedding `svg` directly into the HTML document HOT 1
- DeprecationWarning: Buffer() is deprecated
- Google slides fail to show mermaid images embeded on pptx using mermaid-filter HOT 1
- Need to install librsvg on Mac to use SVG format HOT 1
- fantastic news, sequenceDiagram working with Chinese characters too.
- Mermaid Ink Save Path Option
- I am having trouble getting the filter to work HOT 1
- [Feature request/minor bug] Allow mermaid-filter to work with Bun? HOT 1
- internal syntax error HOT 1
- Hidden graph nodes
- After fresh install, it does not work HOT 3
- pandoc-crossref cannot recognize fig id of mermaid HOT 1
- npm WARN deprecated [email protected]: < 21.5.0 is no longer supported HOT 1
- Does the filter work when converting to PowerPoint pptx format? HOT 1
- can't specify options via pandoc HOT 4
- Environment variable not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mermaid-filter.