Next: , Previous: Math formatting in HTML export, Up: HTML export

12.9.10 Text areas in HTML export

Before Org mode's Babel, one popular approach to publishing code in HTML was by using :textarea. The advantage of this approach was that copying and pasting was built into browsers with simple JavaScript commands. Even editing before pasting was made simple.

The HTML export back-end can create such text areas. It requires an #+ATTR_HTML: line as shown in the example below with the :textarea option. This must be followed by either an example or a src code block. Other Org block types will not honor the :textarea option.

By default, the HTML export back-end creates a text area 80 characters wide and height just enough to fit the content. Override these defaults with :width and :height options on the #+ATTR_HTML: line.

     #+ATTR_HTML: :textarea t :width 40
       (defun org-xor (a b)
          "Exclusive or."
          (if a (not b) b))