Next: , Previous: Language-specific mode properties, Up: Using header arguments

Code block specific header arguments

Header arguments are most commonly set at the ‘src’ code block level, on the #+BEGIN_SRC line. Arguments set at this level take precedence over those set in the org-babel-default-header-args variable, and also those set as header properties.

In the following example, setting results to silent makes it ignore results of the code execution. Setting :exports to code exports only the body of the ‘src’ code block to HTML or LaTeX.:

     #+NAME: factorial
     #+BEGIN_SRC haskell :results silent :exports code :var n=0
     fac 0 = 1
     fac n = n * fac (n-1)

The same header arguments in an inline ‘src’ code block:

     src_haskell[:exports both]{fac 5}

Code block header arguments can span multiple lines using #+HEADER: on each line. Note that Org currently accepts the plural spelling of #+HEADER: only as a convenience for backward-compatibility. It may be removed at some point.

Multi-line header arguments on an unnamed ‘src’ code block:

     #+HEADER: :var data1=1
     #+BEGIN_SRC emacs-lisp :var data2=2
        (message "data1:%S, data2:%S" data1 data2)
     : data1:1, data2:2

Multi-line header arguments on a named ‘src’ code block:

     #+NAME: named-block
     #+HEADER: :var data=2
     #+BEGIN_SRC emacs-lisp
       (message "data:%S" data)
     #+RESULTS: named-block
       : data:2