andorsk / d2-mode

emacs major mode for d2 graphs
GNU General Public License v3.0
69 stars 8 forks source link

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

Closed wowhxj closed 1 year ago

wowhxj commented 1 year ago

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 commented 1 year ago

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

andorsk commented 1 year ago

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

andorsk commented 1 year ago

merged! Thanks @wowhxj

wowhxj commented 1 year ago

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