Skip to content
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

keep up to date to current mermaid.cli #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions mermaid.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
(make-local-variable 'compilation-error-screen-columns))
(setq compilation-error-screen-columns nil))

(defvar mermaid-output-format 'png
(defvar puppeteer-config-file "c:/Users/Administrator/AppData/Roaming/.emacs.d/mermaid/puppeteer-config.json"
"The puppeteer config file to make it work with Chromimum")

(defvar mermaid-output-format 'svg
"The format of generated file")

(defvar mermaid-verbose nil
"Show verbose information when run compiler")

(defvar mermaid-compiler "mermaid"
(defvar mermaid-compiler "mmdc"
"The compiler used to generate output")

(defvar mermaid-mode-map
Expand Down Expand Up @@ -62,21 +65,24 @@

(defun mermaid-output-ext ()
"get the extendsion of generated file"
(if (eq mermaid-output-format 'svg)
".svg"
".png"))
(if (eq mermaid-output-format 'png)
".png"
".svg"))

;;;###autoload
(defun mermaid-compile ()
(interactive)
(let ((cmd (concat mermaid-compiler
(if (eq mermaid-output-format 'svg)
" --svg "
" ")
(if mermaid-verbose
" --verbose "
" ")
(buffer-file-name)))
" -p "
puppeteer-config-file
" -i "
(buffer-file-name)
" -o "
(buffer-file-name)
(mermaid-output-ext)))
(buf-name "*mermaid compilation")
(compilation-mode-hook (cons 'mermaid-compilation-mode-hook compilation-mode-hook)))
(if (fboundp 'compilation-start)
Expand Down
4 changes: 4 additions & 0 deletions puppeteer-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": ["--no-sandbox"],
"executablePath": "C:/chrome-win32/chrome.exe"
}