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

d2 has no shorthand flag 'o'. Update to support org-src. #34

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

wowhxj
Copy link
Contributor

@wowhxj wowhxj commented Dec 12, 2022

Based on d2 help doc, d2 doesn't have shorthand flag 'o'. Change org-babel-default-header-args:d2 function to make org-src block work.

$ d2 --help
Usage:
  d2 [--watch=false] [--theme=0] file.d2 [file.svg | file.png]
  d2 layout [name]
  d2 fmt file.d2

d2 compiles and renders file.d2 to file.svg | file.png
It defaults to file.svg if an output path is not provided.

Use - to have d2 read from stdin or write to stdout.

See man d2 for more detailed docs.

Flags:
  -w, --watch           $D2_WATCH   watch for changes to input and live reload. Use $HOST and $PORT to specify the listening address.
                                    (default localhost:0, which is will open on a randomly available local port). (default false)
  -h, --host string     $HOST       host listening address when used with watch (default "localhost")
  -p, --port string     $PORT       port listening address when used with watch (default "0")
  -b, --bundle          $D2_BUNDLE  when outputting SVG, bundle all assets and layers into the output file. (default true)
  -d, --debug           $DEBUG      print debug logs. (default false)
  -l, --layout string   $D2_LAYOUT  the layout engine used. (default "dagre")
  -t, --theme int       $D2_THEME   the diagram theme ID. For a list of available options, see https://oss.terrastruct.com/d2 (default 0)
  -v, --version                     get the version (default false)


Subcommands:
  d2 layout - Lists available layout engine options with short help
  d2 layout [name] - Display long help for a particular layout engine
  d2 fmt file.d2 - Format file.d2

See more docs and the source code at https://oss.terrastruct.com/d2

@andorsk
Copy link
Owner

andorsk commented Dec 13, 2022

@wowhxj Thank you for the PR! LGTM. Will run the check and then merge.

@andorsk
Copy link
Owner

andorsk commented Dec 13, 2022

@wowhxj looks like a whitespace is at the end, failing elisp check. Can you fix the formatting? The content looks good though.

@andorsk andorsk added the enhancement New feature or request label Dec 13, 2022
Copy link
Owner

@andorsk andorsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: suggestion to remove whitespace. Thank you for the PR!

d2-mode.el Outdated
@@ -114,8 +114,8 @@
(error "D2 requires a \":file\" header argument")))
(temp-file (org-babel-temp-file "d2-"))
(cmd (concat (shell-quote-argument d2-location)
" -o " (org-babel-process-file-name out-file)
" -i " temp-file
" " temp-file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" " temp-file
" " temp-file

Signed-off-by: Randolph HUANG <[email protected]>
@andorsk andorsk merged commit d57d540 into andorsk:main Dec 13, 2022
@andorsk
Copy link
Owner

andorsk commented Dec 13, 2022

merged! Thanks @wowhxj

@wowhxj
Copy link
Contributor Author

wowhxj commented Dec 13, 2022

Sorry for the late response. Thanks for your quick action. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants