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

Org-mode #42

Open
joinr opened this issue Jan 26, 2019 · 5 comments
Open

Org-mode #42

joinr opened this issue Jan 26, 2019 · 5 comments

Comments

@joinr
Copy link

joinr commented Jan 26, 2019

Adding org support as an option (in addition to existing markdown) would be useful.

@metasoarous
Copy link
Owner

metasoarous commented Jan 28, 2019

Hi @joinr. Thanks for posting this issue.

As I mentioned on slack, I don't use emacs, and am probably not the best person to be working on this, but I think it's a great idea, and encourage you or any one else interested to put forward a proposal.

Thanks again.

@behrica
Copy link
Contributor

behrica commented Feb 22, 2019

I use vega-lite with org mode.

The main idea is to do this 3 steps to include a vega lite spec in a org mode file:

a)
In a "clojure" block:

  1. Specify the "spec"
  2. Convert spec to json and write to disk
(def spec ....
(spit "spec.vl"
 (json/generate-string spec))

b)
In a following "shell block":

  • convert the json to a svg file using the command line utils
#+BEGIN_SRC shell
vl2svg spec.vl  spec.svg
#+END_SRC

c)
Include the "svg" file into org mode via

 [[file:spec.svg]]

@vladkotu
Copy link

@behrica is right - i was able to use vega charts in org-more by relaying on vega-cli tool.
You even don't need oz for that.Here is example for reference

@yubrshen
Copy link
Contributor

Although @behrica's work-flows works,
I wish to be able to write spec in Clojure via Oz, and automatically
get the svg file generated and embedded in org-mode buffer.
The desired work-flow should be similar to the code block of plantuml.

For example,

#+BEGIN_SRC oz :exports :file ./from-vega-lite.svg
spec in Clojure via oz
#+END_SRC

You may find some examples of how convenient to specify diagram with plantuml with org-mode's code block.

With this support, I will be able to use org as markdown syntax to
write document with oz for vega-lite specification, without manually
handling the generation of vega-lite figure generation and embedding the
generated file.

@metasoarous
Copy link
Owner

Hey @yubrshen.

Right now, you could do something equivalent to what @behrica suggests by using oz.core/export!. For svg, this will try to use graalvm to render (without having to install the vega-cli using npm or whatever), but for jpg you need canvas, which I don't think graalvm supports yet (though I'd love for someone to prove me wrong on this). This reduces the steps in your org-mode files to 2 instead of 3. You would still need to include the file into org-mode the way @behrica describes (step c).

If there's a way to facilitate a one step process in org-mode, I'm more than happy to accommodate that. I just don't know enough about org-mode to be of much help sorting out that side of it.

The other thing I would really like to support in Oz is ingest of org-mode files and interpretation as hiccup. Perhaps we can even extend Oz's notion of parallelized clj code execution, so that you could use Oz's notebook functionality with org-mode files. I don't know how much control org-mode gives you over what sort of output formats/templates are available, but Oz is quite flexible in this regard, and only becoming more capable. So perhaps it would be useful to have a flexible rendering system (static site generation, pdf documents, etc) for org-mode files?

Happy to discuss more if anything like that makes sense.

Thanks again

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

No branches or pull requests

5 participants