org: JavaScript support
12.6.11 JavaScript supported display of web pages
-------------------------------------------------
Sebastian Rose has written a JavaScript program especially designed to
enhance the web viewing experience of HTML files created with Org. This
program allows you to view large files in two different ways. The first
one is an _Info_-like mode where each section is displayed separately
and navigation can be done with the ‘n’ and ‘p’ keys (and some other
keys as well, press ‘?’ for an overview of the available keys). The
second view type is a _folding_ view much like Org provides inside
Emacs. The script is available at <http://orgmode.org/org-info.js> and
you can find the documentation for it at
<http://orgmode.org/worg/code/org-info-js/>. We host the script at our
site, but if you use it a lot, you might not want to be dependent on
<http://orgmode.org> and prefer to install a local copy on your own web
server.
All it then takes to use this program is adding a single line to the
Org file:
#+INFOJS_OPT: view:info toc:nil
If this line is found, the HTML header will automatically contain the
code needed to invoke the script. Using the line above, you can set the
following viewing options:
path: The path to the script. The default is to grab the script from
<http://orgmode.org/org-info.js>, but you might want to have
a local copy and use a path like ‘../scripts/org-info.js’.
view: Initial view when the website is first shown. Possible values are:
info Info-like interface with one section per page.
overview Folding interface, initially showing only top-level.
content Folding interface, starting with all headlines visible.
showall Folding interface, all headlines and text visible.
sdepth: Maximum headline level that will still become an independent
section for info and folding modes. The default is taken from
‘org-export-headline-levels’ (= the ‘H’ switch in ‘#+OPTIONS’).
If this is smaller than in ‘org-export-headline-levels’, each
info/folding section can still contain child headlines.
toc: Should the table of contents _initially_ be visible?
Even when ‘nil’, you can always get to the "toc" with ‘i’.
tdepth: The depth of the table of contents. The defaults are taken from
the variables ‘org-export-headline-levels’ and ‘org-export-with-toc’.
ftoc: Does the CSS of the page specify a fixed position for the "toc"?
If yes, the toc will never be displayed as a section.
ltoc: Should there be short contents (children) in each section?
Make this ‘above’ if the section should be above initial text.
mouse: Headings are highlighted when the mouse is over them. Should be
‘underline’ (default) or a background color like ‘#cccccc’.
buttons: Should view-toggle buttons be everywhere? When ‘nil’ (the
default), only one such button will be present.
You can choose default values for these options by customizing the
variable ‘org-html-infojs-options’. If you always want to apply the
script to your pages, configure the variable ‘org-html-use-infojs’.