February 6, 2019

Brief foray into ox-slimhtml

Intro

When I began creating this website I was overwhelmed by the complexity of ox-html.el which is responsible for exporting org files to HTML. I came across ox-slimhtml.el which is simpler and easier to understand the mechanics of what is happening upon export.1

Code

For posterity here’s how my org-publish-project-alist was shaping up under the ox-slimhtml exporter:

html code
<link href='/styles.css' rel='stylesheet' type='text/css'>
emacs-lisp code
:base-extension "org"
:publishing-function ox-slimhtml-publish-to-html
:html-doctype "html5"
:html-head-extra "
<<html-header>>
"
:author "Akira Kyle"
:email "akira@akirakyle.com"
:recursive t
emacs-lisp code
:base-extension "svg\\|pdf"
:publishing-function org-publish-attachment
:recursive t
emacs-lisp code
("pages"
 :base-directory "~/Documents/website/pages/"
 :publishing-directory "~/Documents/www/"
 <<publish-common-html-props>>
 )
("blog"
 :base-directory "~/Documents/website/blog/"
 :publishing-directory "~/Documents/www/blog/"
 <<publish-common-html-props>>

 :auto-sitemap t
 :sitemap-filename "blog.org"
 :sitemap-title "Akira Kyle's Blog"
 )
("pages-resources"
 :base-directory "~/Documents/website/pages/"
 :publishing-directory "~/Documents/www/"
 <<publish-common-resource-props>>
)
("blog-resources"
 :base-directory "~/Documents/website/blog/"
 :publishing-directory "~/Documents/www/blog/"
 <<publish-common-resource-props>>
 )
("website"
 :components ("pages" "pages-resources" "blog" "blog-resources"))
emacs-lisp code
(setq org-html-htmlize-output-type 'css)

(setq org-publish-project-alist `(
<<org-publish-components>>
))

(org-publish "website" t)

Conclusions

I abandoned this as it didn’t have the ability to do syntax highlighting of code blocks through htmlize.el which I wanted. I may end up returting to ox-slimhtml as the starting point for my own custom org HTML exporter some day when I feel I need even more custom control. In any case looking over the source of ox-slimhtml is a gentler intro to understanding the source of ox-html and so I was glad to know of it’s existence.

Footnotes:

1

compare ox-html.el at 3842 lines of code vs ox-slimhtml.el at only 592 lines of code

Email: akira@akirakyle.com
GPG Public Key: 963C 2413 0BD3 BF1B 624C EF4C 8850 284C 20B8 078D