Open dalanicolai opened 2 years ago
So even better probably would be to use firefox (or chrome) with the headless --screenshot option, then add the produced image as a display property to (over) the original html.
Unfortunately, both the firefox and chrome screenshot options currently don't work here, so that I can not try it out.
For people that are interested, for now I am using the following function to 'process' the results:
(defun org-babel-process-export-html-block ()
(interactive)
(let* ((element (org-element-context))
(beg (org-element-property :begin element))
(end (org-element-property :end element))
(value (org-element-property :value element)))
(with-temp-buffer
(insert value)
(shr-render-buffer (current-buffer)))
(let ((html-contents (with-current-buffer "*html*"
(unless (text-properties-at (point))
(let ((contents (buffer-string)))
(kill-buffer)
contents)))))
(when (print html-contents)
(kill-region beg end)
(goto-char beg)
(insert "#+RESULTS\n: " html-contents "\n")))))
Call it with your cursor placed inside the results export-html block.
This feature request suggests/asks for a solution for #340.
When plotting using the wolfram kernel, I can copy the returned html to the scratch buffer and then do
M-x shr-render-buffer/region
to render the image, so I guess it should be possible to somehow render the (html) result usingshr
directly. Using shr is really nice because it even correctly renders results containing multiple images directly. For example it renders correctly the output from the following source blockWould it be possible to implement the option to use
shr-render-buffer/region
for rendering the output? Or should I address this request to org-mode directly (although it looks like ob-jupyter 'bypasses' much of theorg-babel-insert-result
functionality).It would be amazing if shr could render over the html (via text-properties/overlay) so that the data is stored within the org file.