Skip to content

misohena/ob-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

ob-html.el

This code allows you to evaluate HTML in org-mode code blocks.

./screenshot.png

Setup

(with-eval-after-load "org"
  (require 'ob-html)
  (org-babel-html-enable-open-src-block-result-temporary)) ;;Enable C-c C-o on html code block

Customize the variable org-babel-html-chrome-executable or org-babel-html-screenshot-method.

Examples

Generate html export block:

#+begin_src html :results replace html :exports both
<p><strong>STRONG</strong> <ins>INS</ins> <del>DEL</del></p>
#+end_src

#+RESULTS:
#+begin_export html
<p><strong>STRONG</strong> <ins>INS</ins> <del>DEL</del></p>
#+end_export

Generate external html file:

#+begin_src html :results replace file :file example.html :exports both
<!DOCTYPE html>
<html><head><title>example</title></head><body><p>Example</p></body></html>
#+end_src

#+RESULTS:
[​[file:example.html]]

Generate screenshot image file:

#+begin_src html :results replace file graphics :file example.png :width 640 :height 100 :exports both
<!DOCTYPE html>
<html><head><title>example</title></head><body><p>Hello</p></body></html>
#+end_src

#+RESULTS:
[​[file:example.png]]

Generate nothing but open HTML as temporary file:

#+begin_src html
<!DOCTYPE html>
<html><head><title>example</title></head><body><p>Hello</p></body></html>
#+end_src

ToDo

  • Add session support
  • Add more screenshot methods
    • PhantomJS
    • puppeteer
    • PlayWright
  • Fix org-babel-html-chrome-executable

Releases

No releases published

Packages

No packages published