-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
excalidraw CLI #1261
Comments
Hello there, I'm currently trying to implement it in the following repo : Early concept demoI may consider opening another issue to export some useful Excalidraw renderer methods and constants (especially |
Awesome @tommywalkie! When you feel like it’s more polished, would you be willing to perhaps collab with @MichaelDeBoey to use it for |
Would be awesome if we could use this inside |
Hi @MichaelDeBoey @j-f1, thanks for your response, I would be glad to collab once I polished the CLI. Initially, I was planning to make it work for Rollup (for a Sapper/Svelte blog) but implementing it as a Gatsby plugin would be awesome! |
The experimental CLI tool has been polished and is now close to a stable release. NPM package : Demo (
|
@tommywalkie What So what I want to do is provide you with a link and get the correct embed code or |
@MichaelDeBoey I think my question was poorly worded, I was wondering about how to actually get the JSON from Excalidraw, using some URL link. But now, after some researches, I became aware of Lines 235 to 238 in 482fa2d
If this is what I think, I can add "Handle Excalidraw URLs as input" as a new CLI feature which then would provide a lightweight easy-to-use alternative to puppeteer in MichaelDeBoey/gatsby-remark-embedder#122
|
@tommywalkie After talking to @j-f1 this is my understanding of how @excalidraw is working:
The thing I'm doing in the So I could use http://json.excalidraw.com, but then I have to do the decode of the blob myself Another option would be to copy-paste the @excalidraw code, but that would cause problems each time you guys change something on your end so that's not the way we want to go. So what I would like to have is having a lightweight way (this could be an |
@MichaelDeBoey I understand the issue very well, I already opened #1780 because I have this exact problem on the rendering process because I don't have access to |
Kroki-cli now supports SVG generation using excalidraw -> https://github.com/yuzutech/kroki-cli |
I didn't follow the whole conversation.. but should we maybe create an official |
You can write one with
And you may use it with I don't know much about JS so this code might appear ugly, but it works 😂. |
Here's another one I just found: https://github.com/JRJurman/excalidraw-to-svg Seems to do things using JSDOM to create a fake page with an export script. Probably the best approach. There are a couple of bugs in it but it did work after I fixed them. |
Cool. Note that we will at some point be decoupling the renderer, UI, and the editor, so that you won't have to fake the DOM. But it's unclear when we'll be able to get to it. |
That would be great. Looking forward to a WASM based implementation with a pluggable rendering API! :-P In the mean time I finally wrote a solid tool to do it. Thanks to @JRJurman - probably would have given up trying to figure JSDom out with his code. I manage to simplify it quite a lot, fix various issues, and also add PDF export and some workarounds for font issues (e.g. embedding them). Here it is: 👉 https://www.npmjs.com/package/excalidraw_export 👈
Please let me know if the |
I feel like this could be achieved using the web's File System API, rathor then forcing the user to download a package. It may also be easier to implement using this API.
Update: I see that excalidraw already works offline using PWAs. I don't see any reason to implement a CLI instead of using web APIs, using web APIs also allows for functionality on every OS. |
Forgive my ignorance, how does one use a File System API or web API from another program or the command line? |
I'm a bit confused about what you mean exactly.
|
Oh hmm I thought you were responding to the original post, and suggesting that the Filesystem APIs and Web APIs can solve the issue, and I was confused.
To clarify, this is not the question of the OP. The OP is about being able to run the the entire |
I was responding to the origianal post, saying that the web's filesystem API can be used to save a file without getting the user to enter the path of the file each time that it is saved. To be clear, this solution would not allow the user to use a CLI command, instead, the user would use the excalidraw website and click a button that could be titled "open excalidraw file from your computer and edit it". This button would use the web's file system API to allow the user to select a file that can be saved without the user having to select the path to the file everytime. This solution also wouldn't involve the user installing a CLI package. I think that using the web's filesystem API in excalidraw would be a better solution then the CLI command that was suggested in the original post becuase it means that the user does not have to install a package, and also becuase using the web's file system API would work on almost any web broweser, rathor then it having to be maintained for every OS and CPU architecture.
The web's file system API could allow for this wihout a CLI command/package, but that is not what I suggested in my original comment The thing that I was confused about was what exactly was meant by your question becuase the web's file system API cannot be used on the command line:
|
Right, which is why i don't understand how your solution is a solution. |
To be clear: I am trying to use excalidraw in my book, which uses LaTeX tooling. For graphviz, I use dot, and it takes my |
I asked for two features which may have confused all the discussions :) |
Ah my bad, I think I get the confusion now. |
Hi there,
I was wondering, what if we have a CLI for excalidraw?
This will open a browser. If
my-drawing.excalidraw
already exists, it will load it.When user clicks "save" button, it won't show the dialog but quietly save to
my-drawing.excalidraw
.with
--export
given, whenever user saves, the PNG version is exported as well.I guess this can unblock new workflows, for example, for developers who want to have drawings in their git repository.
What do you think?
The text was updated successfully, but these errors were encountered: