ardumont / org2jekyll

Blogging with org-mode and jekyll without alien yaml headers.
GNU General Public License v2.0
71 stars 19 forks source link

Using org2jekyll with org R source code blocks and plots ? #39

Closed behrica closed 4 years ago

behrica commented 8 years ago

I try to use org2jekyll with R code blocks which produce a plot and want that the images are inlined in the html page produced by jekyll.

I get it working to have images generated in the right place, so in the "img" folder, like this:

#+begin_src R :results output graphics :exports both :file img/fig.png 
 plot(iris)
#+end_src

But the the org2jekyll functions produces html file with a relative link as well, which does not work for the produced static pages, as the 'img' folder is not in the subfolder-per-day, but in main folder.

I am not sure, if there is something to configure in emacs/jekyll or if it is not supported.

I am a newbie regarding jekyyll and org publishing in general.

It does work to create an additional link by hand in the org file, such as, but this is more a workarround.

[[file:/img/fig.png]]

Any help would be appreciated.

ardumont commented 8 years ago

Hello,

Thanks for the thorough report.

... I am not sure, if there is something to configure in emacs/jekyll or if it is not supported.

Well, i did nothing specific about it so it seems to not be supported.

It does work to create an additional link by hand in the org file, such as, but this is more a workarround. [[file:/img/fig.png]]

Indeed, it's a workaround.

Any help would be appreciated.

Well, i'd need to have some time to take a look at how the block export works. There must be some way to hook oneself to such export and then if some file are mentioned (here :file), those needs to be exported as well in respecting the relative path as well...

It's a use case i did not foresee. Thanks for raising this up. Cheers,

yefeiyu commented 8 years ago

Sure, but it isn't because of org2jekyll. I try this without .emacs , and it is still appear such:

The org file:

[[file:/assets/img/img_2016_05_12__23_26_47.png]]
or 
[[/assets/img/img_2016_05_12__23_26_47.png]]

The html file:

<div class="figure">
<p><img src="file:///assets/img/img_2016_05_12__23_26_47.png" alt="img_2016_05_12__23_26_47.png"><br >
</p>
</div>

Now , I have to write img link with

#+BEGIN_HTML
<img src="/assets/img/img_2016_05_12__23_26_47.png" alt="img_2016_05_12__23_26_47.png"><br >
#+END_HTML

I didn't know how to deal with it.
ardumont commented 4 years ago

Added a demo sample about code block evaluation [1] It's not exactly the same since it's in python but that's something. Also it's reproducible if someone wants to try it out.

I'm closing this now.

[1] https://github.com/ardumont/org2jekyll/blob/master/testing-blog/org/blogging-with-org2jekyll.org#5-evaluate-block-code-the-org-mode-way

Cheers,