1 #+TITLE: Org Export Reference Documentation
2 #+AUTHOR: Nicolas Goaziou
3 #+EMAIL: n.goaziou AT gmail DOT com
4 #+OPTIONS: H:3 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc ':t
5 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
6 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
7 #+TAGS: Write(w) Update(u) Fix(f) Check(c) NEW(n)
12 [[file:../index.org][{Back to Worg's index}]]
14 This document is aimed at back-end developers for the generic export
15 engine =ox.el=. It assumes a good understanding of [[./org-syntax.org][Org syntax]] from
18 It covers [[#back-end][back-end creation]] process, all [[#attributes][attributes]] associated to each
19 element or object type, properties offered by the [[#communication][communication
20 channel]] during export, the [[#filter-system][filter system]] internals and [[#toolbox][tools]] provided
21 by the exporter. Eventually, expected [[#interactive][interactive functions]] aimed at
22 end-users are explained in the last part of this document.
27 A back-end is defined with ~org-export-define-backend~ function. It
28 requires two mandatory arguments: the back-end name and its translation
29 table, an alist that associates element and object types to translator
30 functions. According to the doc-string:
33 These functions should return a string without any trailing space,
34 or nil. They must accept three arguments: the object or element
35 itself, its contents or nil when it isn't recursive and the property
36 list used as a communication channel.
38 Contents, when not nil, are stripped from any global indentation
39 (although the relative one is preserved). They also always end with
40 a single newline character.
42 If, for a given type, no function is found, that element or object
43 type will simply be ignored, along with any blank line or white
44 space at its end. The same will happen if the function returns the
45 nil value. If that function returns the empty string, the type will
46 be ignored, but the blank lines or white spaces will be kept.
48 In addition to element and object types, one function can be
49 associated to the ~template~ symbol and another one to the
52 The former returns the final transcoded string, and can be used to
53 add a preamble and a postamble to document's body. It must accept
54 two arguments: the transcoded string and the property list
55 containing export options.
57 The latter, when defined, is to be called on every text not
58 recognized as an element or an object. It must accept two
59 arguments: the text string and the information channel. It is an
60 appropriate place to protect special chars relative to the back-end.
63 Optionally, the function can set-up back-end specific properties (like
64 values from specific buffer keywords) accessible from every translator
65 function with the ~:options-alist~ keyword. See
66 ~org-export-options-alist~ for details on the structure of the value.
68 As an example, the following excerpt from ~latex~ back-end
69 definition introduces three new buffer keywords (and their
70 headline's property counterpart), and redefine ~DATE~ default value:
72 #+BEGIN_SRC emacs-lisp
73 (org-export-define-backend 'latex
75 :options-alist '((:date "DATE" nil "\\today" t)
76 (:date-format nil nil org-latex-date-timestamp-format)
77 (:latex-class "LATEX_CLASS" nil org-latex-default-class t)
78 (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
79 (:latex-header-extra "LATEX_HEADER" nil nil newline)
80 (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)))
83 It is also possible, with ~:export-block~ keyword, to associate
84 given block names to the ~export-block~ type. Such blocks can
85 contain raw code that will be directly inserted in the output, as
86 long as the corresponding translator function says so.
88 In the following example, in the ~html~ back-end, =HTML= blocks are
89 export blocks. The associated translator function inserts their
90 contents as-is, and ignores any other export block.
92 #+BEGIN_SRC emacs-lisp
93 (org-export-define-backend 'html
95 (export-block . org-html-export-block)
99 (defun org-html-export-block (export-block contents info)
100 "Transcode a EXPORT-BLOCK element from Org to HTML.
101 CONTENTS is nil. INFO is a plist used as a communication
103 (when (string= (org-element-property :type export-block) "HTML")
104 (org-element-property :value export-block)))
107 Eventually ~org-export-define-backend~ allows to define back-ends
108 specific filters. Refer to [[#filter-system][The Filter System]] section for more
111 If the new back-end shares most properties with another one,
112 ~org-export-define-derived-backend~ can be used to simplify the
113 process. In the example below, we implement a new back-end which behaves
114 like ~latex~ excepted for headlines and the template.
116 #+BEGIN_SRC emacs-lisp
117 (org-export-define-derived-backend 'my-latex 'latex
118 :translate-alist '((headline . my-latex-headline-translator)
119 (template . my-latex-template)))
122 Back-ends defined with either function can be registered in the export
123 dispatcher using special keyword =:menu-entry=. See defuns docstrings
124 for more information.
126 * Elements Attributes
128 :CUSTOM_ID: attributes
131 Element attributes are accessed with ~org-element-property~
132 function. Other accessors relative to elements are
133 ~org-element-type~ and ~org-element-contents~.
135 Each greater element, element and object has a fixed set of
136 properties attached to it. Among them, four are shared by all
137 types: ~:begin~ and ~:end~, which refer to the beginning and ending
138 buffer positions of the considered element or object, ~:post-blank~,
139 which holds the number of blank lines, or white spaces, at its end
140 and ~:parent~ which refers to the element or object containing it.
142 Greater elements, elements and objects containing objects will have
143 ~:contents-begin~ and ~:contents-end~ properties to delimit
144 contents. Greater elements and elements accepting affiliated
145 keywords will also have a ~:post-affiliated~ property, referring to
146 the buffer position after any affiliated keyword, when applicable.
148 In addition to these properties, each element can optionally get
149 some more from affiliated keywords, namely: ~:caption~, ~:header~,
150 ~:name~, ~:plot~, ~:results~ or ~:attr_NAME~ where =NAME= stands for
151 the name of an export back-end.
153 At the lowest level, a ~:parent~ property is also attached to any
154 string, as a text property.
156 Other properties, specific to each element or object, are listed
163 - ~:info~ :: Information about function being called, as returned
164 by ~ob-babel-lob-get-info~ (string).
169 No specific property.
175 - ~:hiddenp~ :: Non-nil if the block is hidden (boolean).
181 - ~:duration~ :: Clock duration for a closed clock, or nil (string
183 - ~:status~ :: Status of current clock (symbol: ~closed~ or
185 - ~:value~ :: Timestamp associated to clock keyword (timestamp
192 - ~:value~ :: Contents (string).
198 - ~:value~ :: Comments, with pound signs (string).
204 - ~:value~ :: Comments, without block's boundaries (string).
205 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
211 - ~:value~ :: Full Sexp (string).
217 - ~:drawer-name~ :: Drawer's name (string).
218 - ~:hiddenp~ :: Non-nil if the drawer is hidden (boolean).
220 /Note relative to export:/ The idea behind drawers is that they are
221 transparent export-wise. By default, they should return their
222 contents without additional decorations.
228 - ~:arguments~ :: Block's parameters (string).
229 - ~:block-name~ :: Block's name (string).
230 - ~:drawer-name~ :: Drawer's name (string).
231 - ~:hiddenp~ :: Non-nil if the block is hidden (boolean).
237 - ~:ascii~ :: Entity's ASCII representation (string).
238 - ~:html~ :: Entity's HTML representation (string).
239 - ~:latex~ :: Entity's LaTeX representation (string).
240 - ~:latex-math-p~ :: Non-nil if entity's LaTeX representation
241 should be in math mode (boolean).
242 - ~:latin1~ :: Entity's Latin-1 encoding representation (string).
243 - ~:name~ :: Entity's name, without backslash nor brackets
245 - ~:use-brackets-p~ :: Non-nil if entity is written with optional
246 brackets in original buffer (boolean).
247 - ~:utf-8~ :: Entity's UTF-8 encoding representation (string).
253 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
254 - ~:label-fmt~ :: Format string used to write labels in current
255 block, if different from
256 ~org-coderef-label-format~ (string or nil).
257 - ~:language~ :: Language of the code in the block, if specified
259 - ~:number-lines~ :: Non-nil if code lines should be numbered.
260 A ~new~ value starts numbering from 1 wheareas ~continued~
261 resume numbering from previous numbered block (symbol: ~new~,
263 - ~:options~ :: Block's options located on the block's opening line
265 - ~:parameters~ :: Optional header arguments (string or nil).
266 - ~:preserve-indent~ :: Non-nil when indentation within the block
267 mustn't be modified upon export (boolean).
268 - ~:retain-labels~ :: Non-nil if labels should be kept visible upon
270 - ~:switches~ :: Optional switches for code block export (string or
272 - ~:use-labels~ :: Non-nil if links to labels contained in the
273 block should display the label instead of the
274 line number (boolean).
275 - ~:value~ :: Contents (string).
281 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
282 - ~:type~ :: Related back-end's name (string).
283 - ~:value~ :: Contents (string).
289 - ~:back-end~ :: Relative back-end's name (string).
290 - ~:value~ :: Export code (string).
296 - ~:value~ :: Contents, with colons (string).
298 ** Footnote Definition
302 - ~:label~ :: Label used for references (string).
304 ** Footnote Reference
308 - ~:inline-definition~ :: Footnote's definition, when inlined
309 (secondary string or nil).
310 - ~:label~ :: Footnote's label, if any (string or nil).
311 - ~:raw-definition~ :: Uninterpreted footnote's definition, when
312 inlined (string or nil).
313 - ~:type~ :: Determine whether reference has its definition inline,
314 or not (symbol: ~inline~, ~standard~).
320 In addition to the following list, any property specified in
321 a property drawer attached to the headline will be accessible as an
322 attribute (with an uppercase name, e.g. ~:CUSTOM_ID~).
324 - ~:archivedp~ :: Non-nil if the headline has an archive tag
326 - ~:closed~ :: Headline's CLOSED reference, if any (timestamp
328 - ~:commentedp~ :: Non-nil if the headline has a comment keyword
330 - ~:deadline~ :: Headline's DEADLINE reference, if any (timestamp
332 - ~:footnote-section-p~ :: Non-nil if the headline is a footnote
334 - ~:hiddenp~ :: Non-nil if the headline is hidden (boolean).
335 - ~:level~ :: Reduced level of the headline (integer).
336 - ~:pre-blank~ :: Number of blank lines between the headline and
337 the first non-blank line of its contents
339 - ~:priority~ :: Headline's priority, as a character (integer).
340 - ~:quotedp~ :: Non-nil if the headline contains a quote keyword
342 - ~:raw-value~ :: Raw headline's text, without the stars and the
344 - ~:scheduled~ :: Headline's SCHEDULED reference, if any (timestamp
346 - ~:tags~ :: Headline's tags, if any, without the archive
347 tag. (list of strings).
348 - ~:title~ :: Parsed headline's text, without the stars and the
349 tags (secondary string).
350 - ~:todo-keyword~ :: Headline's TODO keyword without quote and
351 comment strings, if any (string or nil).
352 - ~:todo-type~ :: Type of headline's TODO keyword, if any (symbol:
359 No specific property.
365 - ~:info~ :: Information about function called, as returned by
366 ~org-babel-lob-get-info~ (list).
368 /Note relative to export:/ Since Babel related blocks are expanded
369 before parsing, these can safely be ignored by back-ends.
375 - ~:language~ :: Language of the code in the block (string).
376 - ~:parameters~ :: Optional header arguments (string or nil).
377 - ~:value~ :: Source code (string).
383 In addition to the following list, any property specified in
384 a property drawer attached to the headline will be accessible as an
385 attribute (with an uppercase name, e.g. ~:CUSTOM_ID~).
387 - ~:closed~ :: Inlinetask's CLOSED reference, if any (timestamp
389 - ~:deadline~ :: Inlinetask's DEADLINE reference, if any (timestamp
391 - ~:hiddenp~ :: Non-nil if the headline is hidden (boolean).
392 - ~:level~ :: Reduced level of the inlinetask (integer).
393 - ~:priority~ :: Headline's priority, as a character (integer).
394 - ~:raw-value~ :: Raw inlinetask's text, without the stars and the
396 - ~:scheduled~ :: Inlinetask's SCHEDULED reference, if any
397 (timestamp object or nil).
398 - ~:tags~ :: Inlinetask's tags, if any (list of strings).
399 - ~:title~ :: Parsed inlinetask's text, without the stars and the
400 tags (secondary string).
401 - ~:todo-keyword~ :: Inlinetask's TODO keyword, if any (string or
403 - ~:todo-type~ :: Type of inlinetask's TODO keyword, if any
404 (symbol: ~done~, ~todo~).
410 No specific property.
416 - ~:bullet~ :: Item's bullet (string).
417 - ~:checkbox~ :: Item's check-box, if any (symbol: ~on~, ~off~,
419 - ~:counter~ :: Item's counter, if any. Literal counters become
421 - ~:raw-tag~ :: Uninterpreted item's tag, if any (string or nil).
422 - ~:tag~ :: Parsed item's tag, if any (secondary string or nil).
423 - ~:hiddenp~ :: Non-nil if item is hidden (boolean).
424 - ~:structure~ :: Full list's structure, as returned by
425 ~org-list-struct~ (alist).
431 - ~:key~ :: Keyword's name (string).
432 - ~:value~ :: Keyword's value (string).
434 /Note relative to export:/ Each back-end should, as far as
435 possible, support a number of common keywords. These include:
437 - Back-end relative keyword (i.e. "LATEX" for =ox-latex=), which
438 should always return its value as-is.
440 - "TOC" keyword. It accepts three common values: "headlines",
441 "tables" and "listings". Also, "headlines" value can have an
442 optional numeric argument to specify depth of the contents.
444 See [[#collect-headlines][~org-export-collect-headlines~]], [[#collect-tables][~org-export-collect-tables~]],
445 [[#collect-figures][~org-export-collect-figures~]] and [[#collect-listings][~org-export-collect-listings~]].
453 - ~:begin~ :: Buffer position at first affiliated keyword or at the
454 beginning of the first line of environment (integer).
455 - ~:end~ :: Buffer position at the first non-blank line after last
456 line of the environment, or buffer's end (integer).
457 - ~:post-blank~ :: Number of blank lines between last environment's
458 line and next non-blank line or buffer's end
460 - ~:value~ :: LaTeX code (string).
466 - ~:value~ :: LaTeX code (string).
472 No specific property.
478 - ~:application~ :: Name of application requested to open the link
479 in Emacs (string or nil). It only applies to
481 - ~:path~ :: Identifier for link's destination. It is usually the
482 link part with type, if specified, removed (string).
483 - ~:raw-link~ :: Uninterpreted link part (string).
484 - ~:search-option~ :: Additional information for file location
485 (string or nil). It only applies to "file" type links.
486 - ~:type~ :: Link's type. Possible types (string) are:
487 - ~coderef~ :: Line in some source code,
488 - ~custom-id~ :: Specific headline's custom-id,
489 - ~file~ :: External file,
490 - ~fuzzy~ :: Target, referring to a target object, a named
491 element or a headline in the current parse tree,
492 - ~id~ :: Specific headline's id,
493 - ~radio~ :: Radio-target.
494 It can also be any ~org-link-types~ element.
497 /Notes relative to export:/
499 A fuzzy link with no description should display the cross-reference
500 number of its target. This number can be:
502 - If link's destination is a target object within a footnote, it
503 will be footnote's number.
505 - If link's destination is a target object in a list, it will be an
508 - If link leads to a named element, it will be the sequence number
509 of that element among named elements of the same type.
511 - Otherwise, it will be the number of the headline containing
514 See [[#get-ordinal][~org-export-get-ordinal~]] function.
520 - ~:args~ :: Arguments passed to the macro (list of strings).
521 - ~:key~ :: Macro's name (string).
522 - ~:value~ :: Replacement text (string).
524 /Note relative to export:/ Macro expansion takes place before
525 buffer parsing. As such, export back-ends don't have to handle:
526 they'll never see them.
530 Element containing objects.
532 No specific property.
538 - ~:structure~ :: Full list's structure, as returned by
539 ~org-list-struct~ (alist).
540 - ~:type~ :: List's type (symbol: ~descriptive~, ~ordered~,
547 - ~:closed~ :: Timestamp associated to closed keyword, if any
548 (timestamp object or nil).
549 - ~:deadline~ :: Timestamp associated to deadline keyword, if any
550 (timestamp object or nil).
551 - ~:scheduled~ :: Timestamp associated to scheduled keyword, if any
552 (timestamp object or nil).
558 - ~:hiddenp~ :: Non-nil if drawer is hidden (boolean).
559 - ~:properties~ :: Properties defined in the drawer (alist).
565 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
571 - ~:value~ :: Quoted text (string).
577 - ~:raw-value~ :: Uninterpreted contents (string).
583 No specific property.
589 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
590 - ~:type~ :: Block's name (string).
596 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
597 - ~:label-fmt~ :: Format string used to write labels in current
598 block, if different from
599 ~org-coderef-label-format~ (string or nil).
600 - ~:language~ :: Language of the code in the block, if specified
602 - ~:number-lines~ :: Non-nil if code lines should be numbered.
603 A ~new~ value starts numbering from 1 wheareas ~continued~
604 resume numbering from previous numbered block (symbol: ~new~,
606 - ~:parameters~ :: Optional header arguments (string or nil).
607 - ~:preserve-indent~ :: Non-nil when indentation within the block
608 mustn't be modified upon export (boolean).
609 - ~:retain-labels~ :: Non-nil if labels should be kept visible upon
611 - ~:switches~ :: Optional switches for code block export (string or
613 - ~:use-labels~ :: Non-nil if links to labels contained in the
614 block should display the label instead of the
615 line number (boolean).
616 - ~:value~ :: Source code (string).
622 - ~:value~ :: Full cookie (string).
628 No specific property.
634 - ~:use-brackets-p~ :: Non-nil if contents are enclosed in curly
641 - ~:use-brackets-p~ :: Non-nil if contents are enclosed in curly
648 - ~:tblfm~ :: Formulas associated to the table, if any (string or
650 - ~:type~ :: Table's origin (symbol: ~table.el~, ~org~).
651 - ~:value~ :: Raw ~table.el~ table or nil (string or nil).
657 No specific property.
661 Element containing objects.
663 - ~:type~ :: Row's type (symbol: ~standard~, ~rule~).
669 - ~:value~ :: Target's ID (string).
672 Notes relatives to export:
674 - Target should become an anchor, if back-end permits it.
675 - Target's ID shouldn't be visible on export.
681 - ~:day-end~ :: Day part from timestamp end. If no ending date is
682 defined, it defaults to start day part (integer).
683 - ~:day-start~ :: Day part from timestamp start (integer).
684 - ~:hour-start~ :: Hour part from timestamp end. If no ending date
685 is defined, it defaults to start hour part, if
686 any (integer or nil).
687 - ~:hour-start~ :: Hour part from timestamp start, if specified
689 - ~:minute-start~ :: Minute part from timestamp end. If no ending
690 date is defined, it defaults to start minute part, if any
692 - ~:minute-start~ :: Minute part from timestamp start, if specified
694 - ~:month-end~ :: Month part from timestamp end. If no ending date
695 is defined, it defaults to start month part
697 - ~:month-start~ :: Month part from timestamp start (integer).
698 - ~:raw-value~ :: Raw timestamp (string).
699 - ~:repeater-type~ :: Type of repeater, if any (symbol: ~catch-up~,
700 ~restart~, ~cumulate~ or nil)
701 - ~:repeater-unit~ :: Unit of shift, if a repeater is defined
702 (symbol: ~year~, ~month~, ~week~, ~day~, ~hour~ or nil).
703 - ~:repeater-value~ :: Value of shift, if a repeater is defined
705 - ~:type~ :: Type of timestamp (symbol: ~active~, ~active-range~,
706 ~diary~, ~inactive~, ~inactive-range~).
707 - ~:year-end~ :: Year part from timestamp end. If no ending date
708 is defined, it defaults to start year part
710 - ~:year-start~ :: Year part from timestamp start (integer).
712 Note relative to export: =org.el= provides tools to work on
713 timestamps objects. In particular, back-ends usually make use of
714 ~org-timestamp-translate~ function. Thus, in =ox-html.el=, the
715 timestamp object is first translated:
717 #+BEGIN_SRC emacs-lisp
718 (defun org-html-timestamp (timestamp contents info)
719 "Transcode a TIMESTAMP object from Org to HTML.
720 CONTENTS is nil. INFO is a plist holding contextual
722 (let ((value (org-html-plain-text
723 (org-timestamp-translate timestamp) info)))
724 (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
725 (replace-regexp-in-string "--" "–" value))))
732 No specific property.
738 - ~:value~ :: Contents (string).
742 Element containing objects.
744 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
746 * The Communication Channel
748 :CUSTOM_ID: communication
751 This is the full list of properties available during transcode
752 process, with their category (~option~ or ~tree~) and their value
764 Current back-end used for transcoding.
771 String to write as creation information.
778 String to use as date.
785 Description text for the current data.
799 Tags for exclusion of sub-trees from export process.
802 - type :: list of strings
806 List of export options available for current process.
809 - type :: list of symbols, among ~subtree~, ~body-only~ and
814 Hash table used to memoize results from [[#data][~org-export-data~]].
821 List of global tags for buffer. Used by [[#get-tags][~org-export-get-tags~]] to
822 get tags with inheritance.
825 - type :: list of strings
827 ** ~:footnote-definition-alist~
829 Alist between footnote labels and their definition, as parsed data.
830 Only non-inline footnotes are represented in this alist. Also,
831 every definition isn't guaranteed to be referenced in the parse
832 tree. The purpose of this property is to preserve definitions from
833 oblivion – i.e. when the parse tree comes from a part of the
834 original buffer –, it isn't meant for direct use in a back-end. To
835 retrieve a definition relative to a reference, use
836 [[#get-footnote-definition][~org-export-get-footnote-definition~]] instead.
839 - type :: alist (STRING . LIST)
841 ** ~:headline-levels~
843 :CUSTOM_ID: headline-levels
846 Maximum level being exported as an headline. Comparison is done
847 with the relative level of headlines in the parse tree, not
848 necessarily with their actual level.
853 ** ~:headline-numbering~
855 Alist between headlines' beginning position and their numbering, as
856 a list of numbers – cf. [[#get-headline-number][~org-export-get-headline-number~]].
859 - type :: alist (INTEGER . LIST)
861 ** ~:headline-offset~
863 Difference between relative and real level of headlines in the
864 parse tree. For example, a value of -1 means a level 2 headline
865 should be considered as level 1 —
866 cf. [[#get-relative-level][~org-export-get-relative-level~]].
873 List of elements and objects that will be unconditionally ignored
877 - type :: list of elements
881 Alist between ID strings and destination file's path, relative to
885 - type :: alist (STRING . STRING)
889 Full path to input file, if any.
892 - type :: string or nil
896 List of keywords attached to data.
903 Default language used for translations.
910 Whole parse tree, available at any time during transcoding.
913 - type :: list (as returned by ~org-element-parse-buffer~)
915 ** ~:preserve-breaks~
917 Non-nil means transcoding should preserve all line breaks.
920 - type :: symbol (nil, t)
922 ** ~:section-numbers~
924 Non-nil means transcoding should add section numbers to headlines.
927 - type :: symbol (nil, t)
931 :CUSTOM_ID: select-tags
934 List of tags enforcing inclusion of sub-trees in transcoding. When
935 such a tag is present, sub-trees without it are /de facto/ excluded
936 from the process. See [[#use-select-tags][~:use-select-tags~]].
939 - type :: list of strings
941 ** ~:time-stamp-file~
943 Non-nil means transcoding should insert a time stamp in the output.
946 - type :: symbol (nil, t)
948 ** ~:translate-alist~
950 Alist between element and object types and transcoding functions
951 relative to the current back-end. Special keys ~template~ and
952 ~plain-text~ are also possible.
955 - type :: alist (SYMBOL . FUNCTION)
957 ** ~:use-select-tags~
959 :CUSTOM_ID: use-select-tags
962 When non-nil, a select tags has been found in the parse tree.
963 Thus, any headline without one will be filtered out. See
964 [[#select-tags][~:select-tags~]].
967 - type :: interger or nil
969 ** ~:with-archived-trees~
971 Non-nil when archived sub-trees should also be transcoded. If it
972 is set to the ~headline~ symbol, only the archived headline's name
976 - type :: symbol (nil, t, ~headline~)
980 Non-nil means author's name should be included in the output.
983 - type :: symbol (nil, t)
987 Non-nil means clock keywords should be exported.
990 - type :: symbol (nil, t)
994 Non-nil means a creation sentence should be inserted at the end of
995 the transcoded string. If the value is ~comment~, it should be
999 - type :: symbol (~comment~, nil, t)
1003 Non nil means output should contain a date.
1005 - category :: option
1006 - type :: symbol (nil, t)
1010 Non-nil means drawers should be exported. If its value is a list
1011 of names, only drawers with such names will be transcoded.
1013 - category :: option
1014 - type :: symbol (nil, t) or list of strings
1018 Non-nil means output should contain author's email.
1020 - category :: option
1021 - type :: symbol (nil, t)
1023 ** ~:with-emphasize~
1025 Non-nil means emphasized text should be interpreted.
1027 - category :: option
1028 - type :: symbol (nil, t)
1030 ** ~:with-fixed-width~
1032 Non-nil if transcoder should interpret strings starting with
1033 a colon as a fixed-with — verbatim — area.
1035 - category :: option
1036 - type :: symbol (nil, t)
1038 ** ~:with-footnotes~
1040 Non-nil if transcoder should interpret footnotes.
1042 - category :: option
1043 - type :: symbol (nil, t)
1047 Non-nil means ~latex-environment~ elements and ~latex-fragment~
1048 objects should appear in export output. When this property is set
1049 to ~verbatim~, they will be left as-is.
1051 - category :: option
1052 - type :: symbol (~verbatim~, nil, t)
1056 Non-nil means transcoding should include planning info.
1058 - category :: option
1059 - type :: symbol (nil, t)
1063 Non-nil means transcoding should include priority cookies.
1065 - category :: option
1066 - type :: symbol (nil, t)
1068 ** ~:with-smart-quotes~
1070 Non-nil means activate smart quotes during export.
1072 - category :: option
1073 - type :: symbol (nil ,t)
1075 ** ~:with-special-strings~
1077 Non-nil means transcoding should interpret special strings in plain
1080 - category :: option
1081 - type :: symbol (nil, t)
1083 ** ~:with-sub-superscript~
1085 Non-nil means transcoding should interpret subscript and
1086 superscript. With a value of ~{}~, only interpret those using
1089 - category :: option
1090 - type :: symbol (nil, ~{}~, t)
1094 Non-nil means transcoding should interpret tables.
1096 - category :: option
1097 - type :: symbol (nil, t)
1101 Non-nil means transcoding should keep tags in headlines.
1102 A ~not-in-toc~ value will remove them from the table of contents,
1103 if any, nonetheless.
1105 - category :: option
1106 - type :: symbol (nil, t, ~not-in-toc~)
1110 Non-nil means transcoding should include headlines with a TODO
1111 keyword. A ~todo~ value will only include headlines with a TODO
1112 type keyword while a ~done~ value will do the contrary. If a list
1113 of strings is provided, only tasks with keywords belonging to that
1116 - category :: option
1117 - type :: symbol (t, ~todo~, ~done~, nil) or list of strings
1119 ** ~:with-timestamps~
1121 Non-nil means transcoding should include time stamps. Special
1122 value ~active~ (resp. ~inactive~) ask to export only active
1123 (resp. inactive) timestamps. Otherwise, completely remove them.
1125 - category :: option
1126 - type :: symbol: (~active~, ~inactive~, t, nil)
1130 Non-nil means that a table of contents has to be added to the
1131 output. An integer value limits its depth.
1133 - category :: option
1134 - type :: symbol (nil, t or integer)
1136 ** ~:with-todo-keywords~
1138 Non-nil means transcoding should include TODO keywords.
1140 - category :: option
1141 - type :: symbol (nil, t)
1145 :CUSTOM_ID: filter-system
1148 Filters sets are lists of functions. They allow to pre-process
1149 parse tree before export and to post-process output of each
1150 transcoded object or element.
1152 Each function in a set must accept three arguments: a string (or
1153 a parse tree as a special case), a symbol representing the current
1154 back-end, and the communication channel, as a plist.
1156 As an exception, functions in options filter only accept two
1157 arguments: the property list containing the export options and the
1158 back-end, as a symbol.
1160 From the developer side, filters sets can be installed using
1161 ~:filters-alist~ keyword while defining the back-end with
1162 ~org-export-define-derived-backend~. Each association has a key
1163 among the following symbols and a function or a list of functions as
1166 - ~:filter-babel-call~
1168 - ~:filter-center-block~
1172 - ~:filter-comment-block~
1174 - ~:filter-dynamic-block~
1176 - ~:filter-example-block~
1177 - ~:filter-export-block~
1178 - ~:filter-export-snippet~
1179 - ~:filter-final-output~
1180 - ~:filter-fixed-width~
1181 - ~:filter-footnote-definition~
1182 - ~:filter-footnote-reference~
1183 - ~:filter-headline~
1184 - ~:filter-horizontal-rule~
1185 - ~:filter-inline-babel-call~
1186 - ~:filter-inline-src-block~
1187 - ~:filter-inlinetask~
1191 - ~:filter-latex-environment~
1192 - ~:filter-latex-fragment~
1193 - ~:filter-line-break~
1196 - ~:filter-node-property~
1198 - ~:filter-paragraph~
1199 - ~:filter-parse-tree~
1200 - ~:filter-plain-list~
1201 - ~:filter-plain-text~
1202 - ~:filter-planning~
1203 - ~:filter-property-drawer~
1204 - ~:filter-quote-block~
1205 - ~:filter-quote-section~
1206 - ~:filter-radio-target~
1208 - ~:filter-special-block~
1209 - ~:filter-src-block~
1210 - ~:filter-strike-through~
1211 - ~:filter-statistics-cookie~
1212 - ~:filter-subscript~
1213 - ~:filter-superscript~
1215 - ~:filter-table-cell~
1216 - ~:filter-table-row~
1218 - ~:filter-timestamp~
1219 - ~:filter-underline~
1220 - ~:filter-verbatim~
1221 - ~:filter-verse-block~
1224 For example, ~ascii~ back-end implements a filter that makes sure
1225 headlines end with two blank lines:
1227 #+BEGIN_SRC emacs-lisp
1228 (org-export-define-backend 'ascii
1230 :filters-alist '((:filter-headline . org-ascii-filter-headline-blank-lines)
1231 (:filter-section . org-ascii-filter-headline-blank-lines)))
1233 (defun org-ascii-filter-section-blank-lines (headline back-end info)
1234 "Filter controlling number of blank lines after a section."
1235 (let ((blanks (make-string 2 ?\n)))
1236 (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))
1244 A whole set of tools is available to help build new exporters. Any
1245 function general enough to have its use across a couple of back-ends
1248 Many of them are high-level access to properties from the
1249 communication channel. As such, they should be preferred to
1250 straight access to communication channel, when possible.
1252 ** ~org-element-adopt-element~
1254 :CUSTOM_ID: adopt-element
1257 Add an element to the contents of another element.
1259 See also: [[#set-element][~org-element-set-element~]]
1261 ** ~org-element-set-element~
1263 :CUSTOM_ID: set-element
1266 Replace an element with another in the parse tree.
1268 See also: [[#adopt-element][~org-element-adopt-element~]].
1270 ** ~org-export-activate-smart-quotes~
1272 :CUSTOM_ID: activate-smart-quotes
1275 Transform quotes and apostrophes into their "smart" counterpart in
1278 It should be used after a check against ~:with-smart-quotes~ value
1279 in communication channel.
1281 Since this function needs the original string, it may be useful to
1282 apply others transformations (i.e. characters protection) on a copy
1283 of that string and provide the pristine original string as the
1286 For example, in ~html~ back-end, it is necessary to protect "<",
1287 ">" and "&" characters before calling this function. Here's an
1288 excerpt of its ~plain-text~ transcoder:
1290 #+BEGIN_SRC emacs-lisp
1291 (let ((output text))
1292 ;; Protect following characters: <, >, &.
1293 (setq output (org-html-encode-plain-text output))
1294 ;; Handle smart quotes. Be sure to provide original string since
1295 ;; OUTPUT may have been modified.
1296 (when (plist-get info :with-smart-quotes)
1297 (setq output (org-export-activate-smart-quotes output :html info text)))
1303 ** ~org-export-collect-figures~
1305 :CUSTOM_ID: collect-figures
1308 Return a list of all exportable figures in parse tree.
1310 Used to build a table of figures.
1312 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1313 [[#collect-tables][~org-export-collect-tables~]], [[#collect-listings][~org-export-collect-listings~]].
1315 ** ~org-export-collect-footnote-definitions~
1317 :CUSTOM_ID: collect-footnote-definitions
1320 List actually used footnotes definitions in order to add footnote
1321 listings throughout the transcoded data.
1323 Feed it with the whole parse tree to get the full footnote listing.
1324 Feed it with the current headline to get partial footnote listing
1325 relative to that headline.
1327 Number, label, if any, and definition are provided.
1329 See also: [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1330 [[#get-footnote-definition][~org-export-get-footnote-definition~]],
1331 [[#get-footnote-number][~org-export-get-footnote-number~]].
1333 ** ~org-export-collect-headlines~
1335 :CUSTOM_ID: collect-headlines
1338 Return a list of all exportable headlines, possibly limited to
1341 Used to build a table of contents.
1343 See also: [[#collect-tables][~org-export-collect-tables~]],
1344 [[#collect-figures][~org-export-collect-figures~]], [[#collect-listings][~org-export-collect-listings~]].
1346 ** ~org-export-collect-listings~
1348 :CUSTOM_ID: collect-listings
1351 Return a list of all exportable source blocks with a caption or
1352 a name in parse tree.
1354 Used to build a table of listings.
1356 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1357 [[#collect-tables][~org-export-collect-tables~]], [[#collect-figures][~org-export-collect-figures~]].
1358 ** ~org-export-collect-tables~
1360 :CUSTOM_ID: collect-tables
1363 Return a list of all exportable tables with a caption or a name in
1366 Used to build a table of tables.
1368 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1369 [[#collect-figures][~org-export-collect-figures~]], [[#collect-listings][~org-export-collect-listings~]].
1371 ** ~org-export-data~
1376 Transcode a given element, object, secondary string or string using
1379 It is used primarily to transcode secondary strings, like ~:title~.
1380 For example ~beamer~ back-end uses the following:
1382 #+BEGIN_SRC emacs-lisp
1383 (defun org-beamer-template (contents info)
1384 (let ((title (org-export-data (plist-get info :title) info)))
1388 ** ~org-export-data-with-backend~
1390 :CUSTOM_ID: data-with-backend
1393 Recursively convert some data (an element, an object, a secondary
1394 string or a string) using another backend.
1396 See also: [[#with-backend][~org-export-with-backend~]],
1397 [[#data-with-translations][~org-export-data-with-translations~]]
1399 ** ~org-export-data-with-translations~
1401 :CUSTOM_ID: data-with-translations
1404 Recursively convert some data (an element, an object, a secondary
1405 string or a string) using a given translation table, which
1406 basically acts as an anonymous back-end.
1408 See also: [[#with-backend][~org-export-with-backend~]],
1409 [[#data-with-backend][~org-export-data-with-backend~]]
1411 ** ~org-export-first-sibling-p~
1413 :CUSTOM_ID: first-sibling-p
1416 Non-nil if an headline is the first of its siblings.
1418 Used to know when to start a list if headline's relative level is
1419 below the one specified in [[#headline-levels][~:headline-levels~]] property.
1421 See also: [[#get-relative-level][~org-export-get-relative-level~]],
1422 [[#number-to-roman][~org-export-number-to-roman~]], [[#last-sibling-p][~org-export-last-sibling-p~]].
1424 ** ~org-export-footnote-first-reference-p~
1426 :CUSTOM_ID: footnote-first-reference-p
1429 Non-nil when a footnote reference if the first reference relative
1432 Used when a back-end needs to attach the footnote definition only
1433 to the first occurrence of the corresponding label.
1435 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1436 [[#get-footnote-definition][~org-export-get-footnote-definition~]],
1437 [[#get-footnote-number][~org-export-get-footnote-number~]].
1439 ** ~org-export-format-code-default~
1441 :CUSTOM_ID: format-code-default
1444 Return contents of a =src-block= or =example-block= element in
1445 a format suited for raw text or verbatim output. More
1446 specifically, it takes care of line numbering and labels
1447 integration depending of element's switches, but no formatting is
1448 otherwise applied to source code.
1450 See also: [[#format-code][~org-export-format-code~]], [[#unravel-code][~org-export-unravel-code~]].
1452 ** ~org-export-format-code~
1454 :CUSTOM_ID: format-code
1457 Helper function to format source code. It applies a given function
1458 on each line of the code, passing current line number and
1459 associated code reference label, if any, as arguments.
1461 See also: [[#format-code-default][~org-export-format-code-default~]], [[#get-loc][~org-export-get-loc~]],
1462 [[#unravel-code][~org-export-unravel-code~]].
1464 ** ~org-export-get-alt-title~
1466 :CUSTOM_ID: get-alt-title
1469 Return the alternative title for a given headline as a secondary
1470 string. If no such title is found, it will return its main title.
1472 This function is useful when building a table of contents.
1474 ** ~org-export-get-caption~
1476 :CUSTOM_ID: get-caption
1479 Return the caption of a given element, as a secondary string. With
1480 an optional argument, return the short caption instead.
1482 As an example, ~ascii~ back-end, when creating a list of listings,
1485 #+BEGIN_SRC emacs-lisp
1486 (defun org-ascii--list-listings (keyword info)
1487 (let ((title (org-ascii--translate "List of Listings" info)))
1493 ;; Use short name in priority, if available.
1494 (let ((caption (or (org-export-get-caption src-block t)
1495 (org-export-get-caption src-block))))
1496 (org-export-data caption info)
1498 (org-export-collect-listings info) "\n"))))
1501 See also: [[#read-attribute][~org-export-read-attribute~]].
1503 ** ~org-export-get-category~
1505 :CUSTOM_ID: get-category
1508 Return category associated to a given element or object. Unlike to
1509 the ~:category~ property from headlines and inlinetasks, this
1510 function handles inheritance and ~CATEGORY~ keywords. Therefore,
1511 it should be the preferred way to retrieve a category during
1514 See also: [[#get-node-property][~org-export-get-node-property~]].
1516 ** ~org-export-get-coderef-format~
1518 :CUSTOM_ID: get-coderef-format
1521 Return an appropriate format string for code reference links.
1523 See also: [[#resolve-coderef][~org-export-resolve-coderef~]].
1525 ** ~org-export-get-date~
1527 :CUSTOM_ID: get-date
1530 Returns a date, as a string or a secondary string. It handles
1531 ~org-export-date-timestamp-format~.
1533 Note that ~:with-date~ property in [[#communication][communication channel]] should be
1534 checked prior to use this, as shown in the following example
1535 extracted from ~ox-latex.el~:
1537 #+BEGIN_SRC emacs-lisp :exports code
1538 (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
1539 (format "\\date{%s}\n" (org-export-data date info)))
1542 ** ~org-export-get-footnote-definition~
1544 :CUSTOM_ID: get-footnote-definition
1547 Retrieve the footnote definition relative to a given footnote
1550 If the footnote definition in inline, it is returned as a secondary
1551 string. Otherwise, it is full Org data.
1553 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1554 [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1555 [[#get-footnote-number][~org-export-get-footnote-number~]].
1557 ** ~org-export-get-footnote-number~
1559 :CUSTOM_ID: get-footnote-number
1562 Return the ordinal attached to a footnote reference or definition.
1564 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1565 [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1566 [[#get-footnote-definition][~org-export-get-footnote-definition~]].
1568 ** ~org-export-get-genealogy~
1570 :CUSTOM_ID: get-genealogy
1573 Return flat list of current object or element's parents from
1574 closest to farthest, along with their contents.
1576 See also: [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1577 [[#get-parent-headline][~org-export-get-parent-headline~]],
1578 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1579 [[#get-previous-element][~org-export-get-previous-element~]].
1581 ** ~org-export-get-headline-number~
1583 :CUSTOM_ID: get-headline-number
1586 Return the section number of an headline, as a list of integers.
1588 See also: [[#headline-numbered-p][~org-export-headline-numbered-p~]],
1589 [[#number-to-roman][~org-export-number-to-roman~]].
1591 ** ~org-export-get-loc~
1596 Return count of accumulated lines of code from previous
1597 line-numbered =example-block= and =src-block= elements, according
1598 to current element's switches.
1600 In other words, the first line of code in the current block is
1601 supposed to be numbered as the returned value plus one, assuming
1602 its ~:number-lines~ properties is non-nil.
1604 See also: [[#format-code][~org-export-format-code~]], [[#unravel-code][~org-export-unravel-code~]].
1606 ** ~org-export-get-next-element~
1608 :CUSTOM_ID: get-next-element
1611 Return element (resp. object or string) after an element
1612 (resp. object), or nil.
1614 See also: [[#get-genealogy][~org-export-get-genealogy~]], [[#get-parent][~org-export-get-parent~]],
1615 [[#get-parent-headline][~org-export-get-parent-headline~]],
1616 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1617 [[#get-previous-element][~org-export-get-previous-element~]].
1619 ** ~org-export-get-node-property~
1621 :CUSTOM_ID: get-node-property
1624 Return the node property associated to an element or object. If
1625 the element is an headline, this is equivalent to reading the
1626 property with ~org-element-property~.
1628 Though, this function can optionally handle inheritance.
1630 See also: [[#get-category][~org-export-get-category~]].
1632 ** ~org-export-get-ordinal~
1634 :CUSTOM_ID: get-ordinal
1637 Associate a sequence number to any object or element. It is meant
1638 to be used to build captions.
1640 Also, it could be applied on a fuzzy link's destination, since such
1641 links are expected to be replaced with the sequence number of their
1642 destination, provided they have no description.
1644 Taken from ~ascii~ back-end, the following example shows how fuzzy
1645 links could be handled :
1647 #+BEGIN_SRC emacs-lisp :exports code
1648 (let ((type (org-element-property :type link)))
1651 ;; Do not apply a special syntax on fuzzy links pointing to targets.
1652 ((string= type "fuzzy")
1653 (let ((destination (org-export-resolve-fuzzy-link link info)))
1654 ;; If link has a description, use it.
1655 (if (org-string-nw-p desc) desc
1657 (let ((number (org-export-get-ordinal destination info)))
1659 (if (atom number) (number-to-string number)
1660 (mapconcat 'number-to-string number "."))))))))
1664 See also : [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]]
1666 ** ~org-export-get-parent-element~
1668 :CUSTOM_ID: get-parent-paragraph
1671 Return the first element containing provided object, if any.
1672 Return nil otherwise.
1674 See also: [[#get-genealogy][~org-export-get-genealogy~]], [[#get-parent][~org-export-get-parent~]],
1675 [[#get-parent-headline][~org-export-get-parent-headline~]],
1676 [[#get-previous-element][~org-export-get-previous-element~]], [[#get-next-element][~org-export-get-next-element~]].
1678 ** ~org-export-get-parent-headline~
1680 :CUSTOM_ID: get-parent-headline
1683 Return the headline containing provided element or object, if any.
1684 Return nil otherwise.
1686 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1687 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1688 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1689 [[#get-previous-element][~org-export-get-previous-element~]].
1691 ** ~org-export-get-parent~
1693 :CUSTOM_ID: get-parent
1696 Return closest element containing current element or object, if
1697 any. Return nil otherwise.
1699 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1700 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1701 [[#get-parent-headline][~org-export-get-parent-headline~]],
1702 [[#get-previous-element][~org-export-get-previous-element~]].
1704 ** ~org-export-get-previous-element~
1706 :CUSTOM_ID: get-previous-element
1709 Return element (resp. object or string) before an element
1710 (resp. object), or nil.
1712 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1713 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1714 [[#get-parent-headline][~org-export-get-parent-headline~]],
1715 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]].
1717 ** ~org-export-get-relative-level~
1719 :CUSTOM_ID: get-relative-level
1722 Return headline level, relatively to the lower headline level in
1723 the parsed tree. It is meant to be used over ~:level~ headline's
1726 See also:[[#first-sibling-p][~org-export-first-sibling-p~]],
1727 [[#get-headline-number][~org-export-get-headline-number~]],[[#headline-numbered-p][~org-export-headline-numbered-p~]],
1728 [[#last-sibling-p][~org-export-last-sibling-p~]].
1730 ** ~org-export-get-table-cell-at~
1732 :CUSTOM_ID: get-table-cell-at
1735 Return exportable cell object at a given position, or nil. Hence,
1736 position ~(0 . 0)~ will always point to the first exportable cell
1739 See also: [[#table-cell-address][~org-export-table-cell-address~]],
1740 [[#table-dimensions][~org-export-table-dimensions~]].
1742 ** ~org-export-get-tags~
1744 :CUSTOM_ID: get-tags
1747 Return list of exportable tags attached to a given headline or
1748 inlinetask element. With an optional argument, tags are inherited
1749 from parent headlines and ~FILETAGS~ keywords.
1751 In particular, it removes select tags and exclude tags. The
1752 function also accepts an arbitrary list of tags for further
1755 For example, ~latex~ back-end uses the following snippet in the
1756 inlinetask transcode function.
1758 #+BEGIN_SRC emacs-lisp
1759 (let ((title (org-export-data (org-element-property :title inlinetask) info))
1760 (todo (and (plist-get info :with-todo-keywords)
1761 (let ((todo (org-element-property :todo-keyword inlinetask)))
1762 (and todo (org-export-data todo info)))))
1763 (todo-type (org-element-property :todo-type inlinetask))
1764 (tags (and (plist-get info :with-tags)
1765 (org-export-get-tags inlinetask info)))
1766 (priority (and (plist-get info :with-priority)
1767 (org-element-property :priority inlinetask))))
1771 ** ~org-export-headline-numbered-p~
1773 :CUSTOM_ID: headline-numbered-p
1776 Non nil when a given headline should be numbered.
1778 See also: [[#get-headline-number][~org-export-get-headline-number~]],
1779 [[#get-relative-level][~org-export-get-relative-level~]].
1781 ** ~org-export-inline-image-p~
1783 :CUSTOM_ID: inline-image-p
1786 Non-nil when the link provided should be considered as an inline
1787 image. Note that it always return nil when the link has
1790 It accepts an optional set of rules in order to tweak the
1791 definition of an inline image, which is, by default, any link
1792 targetting a local file whose extension is either "png", "jpeg",
1793 "jpg", "gif", "tiff", "tif", "xbm", "xpm", "pbm", "pgm" or "ppm".
1795 A set of rules consists in an alist whose key is a type of link, as
1796 a string, and whose value is a regexp matching link's path. As an
1797 example, ~html~ back-end uses the following rules:
1799 #+BEGIN_SRC emacs-lisp
1800 '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
1801 ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
1802 ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
1805 See also: [[#solidify-link-text][~org-export-solidify-link-text~]],
1806 [[#get-coderef-format][~org-export-get-coderef-format~]], [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]].
1808 ** ~org-export-last-sibling-p~
1810 :CUSTOM_ID: last-sibling-p
1813 Non-nil if an headline is the last of its siblings.
1815 Used to know when to close a list if headline's relative level is
1816 below the one specified in [[#headline-levels][~:headline-levels~]] property.
1818 See also: [[#get-relative-level][~org-export-get-relative-level~]],
1819 [[#number-to-roman][~org-export-number-to-roman~]], [[#first-sibling-p][~org-export-first-sibling-p~]].
1821 ** ~org-export-number-to-roman~
1823 :CUSTOM_ID: number-to-roman
1826 Convert numbers to roman numbers. It can be used to provide roman
1827 numbering for headlines and numbered lists.
1829 See also: [[#get-headline-number][~org-export-get-headline-number~]].
1831 ** ~org-export-read-attribute~
1833 :CUSTOM_ID: read-attribute
1836 Read a property from a given element as a plist. It can be used to
1837 normalize affiliated keywords' syntax. For example, the following
1838 affiliated keywords:
1841 ,#+ATTR_HTML: :width 10 :height 5
1842 ,#+ATTR_HTML: :file "filename.ext"
1845 would be returned as:
1847 #+BEGIN_SRC emacs-lisp
1848 '(:width 10 :height 5 :file "filename.ext")
1851 See also: [[#get-caption][~org-export-get-caption~]].
1853 ** ~org-export-resolve-coderef~
1855 :CUSTOM_ID: resolve-coderef
1858 Search for a code reference within ~src-block~ and ~example-block~
1859 elements. Return corresponding --possibly accumulated-- line
1860 number, or reference itself, depending on container's switches.
1862 See also : [[#get-coderef-format][~org-export-get-coderef-format~]],
1863 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-id-link][~org-export-resolve-id-link~]],
1864 [[#resolve-radio-link][~org-export-resolve-radio-link~]].
1866 ** ~org-export-resolve-fuzzy-link~
1868 :CUSTOM_ID: resolve-fuzzy-link
1871 Search destination of a fuzzy link — i.e. it has a ~fuzzy~ ~:type~
1872 attribute – within the parsed tree, and return that element,
1875 See also: [[#get-ordinal][~org-export-get-ordinal~]], [[#resolve-coderef][~org-export-resolve-coderef~]],
1876 [[#resolve-id-link][~org-export-resolve-id-link~]], [[#resolve-radio-link][~org-export-resolve-radio-link~]],
1877 [[#solidify-link-text][~org-export-solidify-link-text~]].
1879 ** ~org-export-resolve-id-link~
1881 :CUSTOM_ID: resolve-id-link
1884 Search headline targetted by an id link --- i.e. it has a ~id~ or
1885 ~custom-id~ ~:type~ attribute --- within the parse tree. Return
1886 the matching headline in the tree, the name of the external file,
1887 as a string, or nil.
1889 See also : [[#resolve-coderef][~org-export-resolve-coderef~]],
1890 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-radio-link][~org-export-resolve-radio-link~]],
1891 [[#solidify-link-text][~org-export-solidify-link-text~]].
1893 ** ~org-export-resolve-radio-link~
1895 :CUSTOM_ID: resolve-radio-link
1898 Return first radio target object matching a radio link --- that is
1899 with a ~radio~ ~:type~ attribute --- in the parse tree, or nil.
1901 Typically, target's contents are exported through ~org-export-data~
1902 and used as link description, as in the following excerpt from
1905 #+BEGIN_SRC emacs-lisp
1906 (defun org-latex-link (link desc info)
1907 (let* ((type (org-element-property :type link))
1911 ((string= type "radio")
1912 (let ((destination (org-export-resolve-radio-link link info)))
1914 (format "\\hyperref[%s]{%s}"
1915 (org-export-solidify-link-text path)
1916 (org-export-data (org-element-contents destination) info)))))
1920 See also : [[#resolve-coderef][~org-export-resolve-coderef~]],
1921 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-id-link][~org-export-resolve-id-link~]],
1922 [[#solidify-link-text][~org-export-solidify-link-text~]].
1924 ** ~org-export-solidify-link-text~
1926 :CUSTOM_ID: solidify-link-text
1929 Normalize a string, replacing most non-standard characters with
1932 Used to turn targets names into safer versions for links.
1934 See also: [[#inline-image-p][~org-export-inline-image-p~]],
1935 [[#resolve-id-link][~org-export-resolve-id-link~]], [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]],
1936 [[#resolve-radio-link][~org-export-resolve-radio-link~]].
1938 ** ~org-export-table-cell-address~
1940 :CUSTOM_ID: table-cell-address
1943 Return row and column of a given cell object. Positions are
1944 0-indexed and only exportable rows and columns are considered. The
1945 function returns nil if called on a non-exportable cell.
1947 See also: [[#get-table-cell-at][~org-export-get-table-cell-at~]],
1948 [[#table-dimensions][~org-export-table-dimensions~]].
1950 ** ~org-export-table-cell-alignment~
1952 :CUSTOM_ID: table-cell-alignment
1955 Return expected alignment for the contents of a given cell object.
1956 It can be either ~left~, ~right~ or ~center~.
1958 See also: [[#table-cell-borders][~org-export-table-cell-borders~]],
1959 [[#table-cell-width][~org-export-table-cell-width~]].
1961 ** ~org-export-table-cell-borders~
1963 :CUSTOM_ID: table-cell-borders
1966 Indicate expected borders for a given cell object. When non-nil,
1967 return value is a list of symbols among ~top~, ~bottom~, ~above~,
1968 ~below~, ~left~ and ~right~.
1970 Special values ~top~ and ~bottom~ only happen for cells in,
1971 respectively, the first and the last exportable rows.
1973 See also: [[#table-cell-alignment][~org-export-table-cell-alignment~]],
1974 [[#table-cell-width][~org-export-table-cell-width~]].
1976 ** ~org-export-table-cell-ends-colgroup-p~
1978 :CUSTOM_ID: table-cell-ends-colgroup-p
1981 Non-nil when a table cell object ends a column group.
1983 See also: [[#table-cell-starts-colgroup-p][~org-export-table-cell-starts-colgroup-p~]].
1985 ** ~org-export-table-cell-starts-colgroup-p~
1987 :CUSTOM_ID: table-cell-starts-colgroup-p
1990 Non-nil when a table cell object starts a column group.
1992 See also: [[#table-cell-ends-colgroup-p][~org-export-table-cell-ends-colgroup-p~]].
1994 ** ~org-export-table-cell-width~
1996 :CUSTOM_ID: table-cell-width
1999 Return expected width for contents of a given cell object.
2001 Only width specified explicitely through meta-data is considered.
2002 If no such information can be found, return nil instead.
2004 Some back-end may still need to know the actual width of exported
2005 cell's contents in order to compute column's width. In that case,
2006 every cell in the column must be transcoded in order to find the
2007 widest one. The snippet below, extracted from =ox-ascii.el=
2008 illustrates a possible implementation.
2010 #+BEGIN_SRC emacs-lisp
2011 (or (org-export-table-cell-width table-cell info)
2012 (let* ((max-width 0)
2013 (table (org-export-get-parent-table table-cell info))
2014 (specialp (org-export-table-has-special-column-p table))
2015 (col (cdr (org-export-table-cell-address table-cell info))))
2019 ;; For each exportable row, get the cell at column COL and
2020 ;; transcode its contents. Then compare its length with
2021 ;; MAX-WIDTH and keep the greater of two.
2025 (org-element-contents
2026 (elt (if specialp (car (org-element-contents row))
2027 (org-element-contents row))
2035 See also: [[#table-cell-alignment][~org-export-table-cell-alignment~]],
2036 [[#table-cell-borders][~org-export-table-cell-borders~]].
2038 ** ~org-export-table-dimensions~
2040 :CUSTOM_ID: table-dimensions
2043 Return the number of exportable rows and columns in a given table.
2045 See also: [[#get-table-cell-at][~org-export-get-table-cell-at~]],
2046 [[#table-cell-address][~org-export-table-cell-address~]].
2048 ** ~org-export-table-has-header-p~
2050 :CUSTOM_ID: table-has-header-p
2053 Non-nil when table has at least two row groups.
2055 See also: [[#table-has-special-column-p][~org-export-table-has-special-column-p~]],
2056 [[#table-row-is-special-p][~org-export-table-row-is-special-p~]].
2058 ** ~org-export-table-has-special-column-p~
2060 :CUSTOM_ID: table-has-special-column-p
2063 Non-nil when first column in the table only contains meta-data.
2065 See also: [[#table-has-header-p][~org-export-table-has-header-p~]],
2066 [[#table-row-is-special-p][~org-export-table-row-is-special-p~]].
2068 ** ~org-export-table-row-ends-header-p~
2070 :CUSTOM_ID: table-row-ends-header-p
2073 Non-nil when a table row element ends table's header.
2075 See also: [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2076 [[#table-row-group][~org-export-table-row-group~]],
2077 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2078 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2080 ** ~org-export-table-row-ends-rowgroup-p~
2082 :CUSTOM_ID: table-row-ends-rowgroup-p
2085 Non-nil when a a table row element ends a rowgroup, header
2088 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2089 [[#table-row-group][~org-export-table-row-group~]],
2090 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2091 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2093 ** ~org-export-table-row-group~
2095 :CUSTOM_ID: table-row-group
2098 Return row group number for a given table row element.
2100 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2101 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2102 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2103 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2105 ** ~org-export-table-row-is-special-p~
2107 :CUSTOM_ID: table-row-is-special-p
2110 Non-nil a given table row element only contains meta-data.
2112 See also: [[#table-has-header-p][~org-export-table-has-header-p~]],
2113 [[#table-has-special-column-p][~org-export-table-has-special-column-p~]].
2115 ** ~org-export-table-row-starts-header-p~
2117 :CUSTOM_ID: table-row-starts-header-p
2120 Non-nil when a table row element starts table's header.
2122 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2123 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2124 [[#table-row-group][~org-export-table-row-group~]],
2125 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2127 ** ~org-export-table-row-starts-rowgroup-p~
2129 :CUSTOM_ID: table-row-starts-rowgroup-p
2132 Non-nil when a table row element starts a rowgroup, header
2135 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2136 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2137 [[#table-row-group][~org-export-table-row-group~]],
2138 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]].
2140 ** ~org-export-translate~
2142 Translate a string, i.e. "Table of Contents", according to language
2145 Refer to ~org-export-dictionary~ variable for the list of all
2148 ** ~org-export-unravel-code~
2150 :CUSTOM_ID: unravel-code
2153 Clean source code from an =example-block= or a =src-block= element
2154 and extract code references out of it.
2156 Its purpose is to allow to transform raw source code first and then
2157 integrate line numbers or references back into the final output.
2158 That final task can be achieved with the help of
2159 ~org-export-format-code~ function.
2161 See also: [[#format-code][~org-export-format-code~]],
2162 [[#format-code-default][~org-export-format-code-default~]], [[#get-loc][~org-export-get-loc~]].
2164 ** ~org-export-with-backend~
2166 :CUSTOM_ID: with-backend
2169 Export an element or object using locally another back-end.
2171 In a derived back-end, it may be used as a fall-back function once
2172 all specific cases have been handled. Thus, ~beamer~ back-end,
2173 derived from ~latex~, takes care of every internal link type and
2174 delagates everything else to its parent back-end:
2176 #+BEGIN_SRC emacs-lisp
2177 (let ((type (org-element-property :type link))
2178 (path (org-element-property :path link)))
2180 ;; Handle every internal link type, but be careful to ignore "id"
2181 ;; type links pointing to external files.
2182 ((equal type "radio") ...)
2183 ((and (member type '("custom-id" "fuzzy" "id"))
2184 (let ((destination (if (string= type "fuzzy")
2185 (org-export-resolve-fuzzy-link link info)
2186 (org-export-resolve-id-link link info))))
2187 (case (org-element-type destination)
2190 ;; Otherwise, use `latex' back-end.
2191 (t (org-export-with-backend 'latex link contents info))))
2194 See also: [[#data-with-backend][~org-export-data-with-backend~]],
2195 [[#data-with-translations][~org-export-data-with-translations~]]
2197 * Interactive functions
2199 :CUSTOM_ID: interactive
2202 Once the back-end is complete, interactive functions have to be
2203 offered for the user to use it. Depending on the desired output,
2204 three functions are provided to help in this task, along with
2205 a wrapper function allowing to make export asynchronous.
2207 Hence, ~org-export-to-buffer~ may be used if the expected output is
2208 a temporary buffer whereas ~org-export-to-file~ will be used when
2209 exporting to a file. In the latter case,
2210 ~org-export-output-file-name~ can be useful to guess the name of the
2211 output file --- though, don't use it in an external process, since
2212 it will ask the user for a file name when guessing fails. At the
2213 lowest level, ~org-export-as~ returns the output as a string. It
2214 may be used in conjunction with ~org-export-async-start~ in order to
2215 export asynchronously to a temporary buffer, since buffer creation
2216 cannot happen in the external process.
2218 When exporting in background, the output is expected to be displayed
2219 in the Export Stack. The function ~org-export-add-to-stack~ helps
2222 While it is suggested to have a look at their respective docstring,
2223 the following examples illustrate how to combine all these
2226 1. Export to a temporary buffer:
2228 #+BEGIN_SRC emacs-lisp
2230 (defun org-latex-export-as-latex
2231 (&optional async subtreep visible-only body-only ext-plist)
2234 (org-export-async-start
2236 (with-current-buffer (get-buffer-create "*Org E-LATEX Export*")
2239 (goto-char (point-min))
2241 (org-export-add-to-stack (current-buffer) 'latex)))
2242 `(org-export-as 'latex ,subtreep ,visible-only ,body-only ',ext-plist))
2243 (let ((outbuf (org-export-to-buffer 'latex "*Org E-LATEX Export*"
2244 subtreep visible-only body-only ext-plist)))
2245 (with-current-buffer outbuf (LaTeX-mode))
2246 (when org-export-show-temporary-export-buffer
2247 (switch-to-buffer-other-window outbuf)))))
2250 2. Export to a file:
2252 #+BEGIN_SRC emacs-lisp
2254 (defun org-latex-export-to-latex
2255 (&optional async subtreep visible-only body-only ext-plist)
2257 (let ((outfile (org-export-output-file-name ".tex" subtreep)))
2259 (org-export-async-start
2260 (lambda (f) (org-export-add-to-stack f 'latex))
2263 'latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
2265 'latex outfile subtreep visible-only body-only ext-plist))))
2268 It may also be interesting to provide a publishing function for the
2269 back-end. Such function must accept three arguments: a plist
2270 containing properties relative to the project being exported, the
2271 name of the current file being published and the publishing
2272 directory. It often is a simple wrapper around ~org-publish-org-to~
2273 function defined in =ox-publish.el=, as shown in the following
2276 #+BEGIN_SRC emacs-lisp
2277 (defun org-html-publish-to-html (plist filename pub-dir)
2278 (org-publish-org-to 'html filename ".html" plist pub-dir))
2283 # sentence-end-double-space: t