orgstar

Export

orgstar exports HTML, Markdown, PDF, Word, RTF, plain text and iCalendar itself, and hands LaTeX, ODT, ASCII and LaTeX-made PDF to Emacs on the Mac.

Exporting a file

Export works on the file in the current editor, using its text as it is now, saved or not. It applies to Org files only; in any other file the command says "Not an org file". Source blocks are never run during export. Results already in the file are exported as they are; see Code blocks.

On the Mac

FormatCommandEmacs presetDoomNeeds Emacs
HTMLExport to HTMLC-c C-e h hSPC m e h h, C-c C-e h hno
HTML, then open itExport to HTML and OpenC-c C-e h oSPC m e h o, C-c C-e h ono
MarkdownExport to MarkdownC-c C-e m mSPC m e m m, C-c C-e m mno
PDFExport to PDF——no
WordExport to Word——no
RTFExport to RTF——no
Plain textExport to Plain Text——no
PDF through LaTeXExport to PDF with EmacsC-c C-e l pSPC m e l p, C-c C-e l pyes
LaTeXExport to LaTeX with EmacsC-c C-e l lC-c C-e l lyes
ODTExport to ODT with EmacsC-c C-e o oC-c C-e o oyes
ASCII textExport to Plain Text with EmacsC-c C-e t uC-c C-e t uyes
iCalendarExport to iCalendarC-c C-e c fC-c C-e c fno
iCalendar, every agenda fileExport Agenda Files to iCalendarC-c C-e c aC-c C-e c ano
iCalendar, agenda files in oneCombine Agenda Files into iCalendarC-c C-e c cC-c C-e c cno

The keys follow Emacs's export dispatcher (org-export-dispatch). C-c C-e on its own is only a prefix: pause after it and the key hints list the formats. The SPC m e keys work in normal state; the C-c C-e keys work in every Doom state. The Mac preset has no keys for the single formats; its ⇧⌘E opens the export dialog.

All fourteen commands are in File ▸ Export and in the command palette. They write the export beside the Org file, with the same name and the format's extension: .html, .md, .pdf, .docx, .rtf, .tex, .odt, .txt or .ics. The two agenda-file commands are the exceptions; see iCalendar export. #+EXPORT_FILE_NAME: names it instead, as in Org: relative to the Org file's folder (or absolute, or starting with ~), with its extension replaced by the format's, so #+EXPORT_FILE_NAME: out/report writes out/report.html. A file already there is replaced. The message area shows "Exported to name".

The export dialog

Export… in the command palette, or ⇧⌘E in the Mac preset, opens a dialog. The Emacs and Doom presets have no key for it; bind app.export-dialog in keymap.toml if you want one (see Keys and commands). The dialog has:

The dialog remembers the format and the Open after export setting.

On iOS

The Export menu offers HTML, Markdown, PDF, Word, Rich Text (RTF), Plain Text and iCalendar, and Copy as Rich Text. It is under More in the editor, and in the toolbar in the reader. Choosing one opens the share sheet with the exported file, named after the Org file or its #+EXPORT_FILE_NAME:. Send it to another app, or use Save to Files to keep it. The export is the same as on the Mac. LaTeX, ODT, ASCII and PDF through LaTeX are not available on iOS, nor are the agenda-file iCalendar exports.

HTML export

orgstar writes a complete HTML page: a small built-in stylesheet that follows the system's light or dark appearance, the title, an author and date line, the table of contents, then the document. It does not use Emacs, and its output is close to, but not the same as, ox-html.

Title, author and date

KeywordEffect
#+TITLE:The page title and a top heading. Without one, the file's name is used.
#+AUTHOR:Shown under the title.
#+DATE:Shown under the title, after the author, as written.
#+LANGUAGE:The page's lang, and the language of the words the export writes: the table of contents heading, Figure N: captions and the footnotes' label, as Org's org-export-dictionary translates them. Without one, org-export-default-language (en).

Keywords in files named by #+SETUPFILE: count, as they do in Org.

#+OPTIONS

OptionValuesDefaultEffect
toct, nil, a numbertTable of contents, to the given depth. t goes to H.
numt, nil, a numbertSection numbers, to the given depth. t goes to H.
Ha number3The deepest heading level the table of contents and numbering count.
tagst, nil, not-in-toctHeading tags; not-in-toc leaves them out of the table of contents.
todot, niltTODO keywords in headings.
prit, nilnilPriority cookies in headings.
text, niltLaTeX fragments and environments; nil drops them.
titlet, niltThe title heading.
authort, niltThe author.
datet, niltThe date.

A depth for toc or num larger than H is cut to H. Any value other than nil turns an option on. Other #+OPTIONS keys are ignored.

#+TITLE: Field notes
#+AUTHOR: Sam
#+OPTIONS: toc:2 num:nil pri:t ^:{}

Which headings are exported

Each heading gets an id for links: its CUSTOM_ID property, or a slug made from its title. Headings are one level down from Org's: a top-level heading is an <h2>, since the title is the <h1>.

The page head

Each #+HTML_HEAD: and #+HTML_HEAD_EXTRA: line goes into the page's <head> as written, in order. Use them for stylesheets and scripts:

#+HTML_HEAD: <link rel="stylesheet" href="notes.css">

The built-in stylesheet is always included first. Other #+HTML_… keywords are not used.

Math

LaTeX fragments (\(…\), \[…\], $…$, $$…$$) and LaTeX environments are left in the page for MathJax. When the page has any, orgstar adds MathJax 3 from cdn.jsdelivr.net, so the page needs a network connection to show math. Entities such as \alpha become their characters.

Includes

#+INCLUDE: inserts another file before export, as org-export-expand-include-keyword does. Paths are relative to the Org file.

FormEffect
#+INCLUDE: "part.org"The file's contents, read as Org; its includes are expanded too, up to eight levels.
#+INCLUDE: "part.org::*Heading"Only the subtree with that heading.
#+INCLUDE: "part.org::#custom-id"Only the subtree with that CUSTOM_ID.
#+INCLUDE: "code.sh" src shThe file in a source block.
#+INCLUDE: "log.txt" exampleThe file in an example block.
#+INCLUDE: "page.html" export htmlThe file in an export block.
quote, verse, center, commentThe file in a block of that kind.
:lines "5-10"Only those lines; either end may be left out.
:minlevel 2Shift the included headings so the shallowest is at that level.

A file that cannot be read is replaced by an empty line.

Macros

{{{name(arguments)}}} is replaced before export (org-macro-replace-all).

MacroReplaced by
#+MACRO: name texttext, with $1, =$2=… replaced by the arguments.
{{{title}}}, {{{author}}}, {{{date}}}, {{{email}}}That keyword's value.
{{{keyword(NAME)}}}The value of #+NAME:.
{{{input-file}}}The Org file's name.
{{{property(NAME)}}}The value of property NAME of the entry the macro is in; ITEM gives the heading's title. Empty before the first heading.
{{{property(NAME,SEARCH)}}}The same for the entry SEARCH finds in this file: *Title, #custom-id or a title.
{{{n}}}, {{{n(name)}}}A counter, increased at each use. n(name,-) repeats the current value; n(name,5) sets it to 5.
{{{time(format)}}}The current time, formatted as format-time-string does.

Arguments are separated by commas; write \, for a literal comma. Macros defined with (eval …), and macros orgstar does not know, become empty. #+MACRO: definitions in setup files count.

Footnotes

Footnote references, named or inline ([fn:: text]), become numbered superscript links. The notes are collected in a Footnotes section at the end, numbered in the order they are first referenced, each with a link back. A reference without a definition is exported as written.

Tables

An Org table becomes an HTML <table>. If it has rules, the rows before the first rule are the header (<thead>) and the rest the body. #+CAPTION: gives the table a caption. #+TBLFM: lines are not exported.

A table.el table (one drawn with +, - and |) becomes a table with each cell's colspan and rowspan, and the lines in a cell joined with line breaks. If its drawing is not a well-formed table, it is exported as preformatted text.

A link to an image file without a description becomes an <img>. The image types are png, jpg, jpeg, gif, svg, webp, bmp, tif, tiff and avif. #+ATTR_HTML: before the paragraph adds attributes (:width 300 :alt "Map"); without an :alt, the file name is used.

An image paragraph with #+CAPTION: or #+ATTR_HTML: becomes a <figure>; a caption is numbered "Figure 1:", "Figure 2:" and so on.

Links to .org files point to the .html file of the same name. Links to headings ([[*Heading]]), to CUSTOM_ID targets and to radio targets point to the heading's or target's id on the page. id: links point to # and the ID. Other links are written as they are.

Source blocks and their results

A source block is exported as <pre><code class"language-LANG">=, with the code escaped and its common indentation removed. Code in a language the editor highlights is colored as the editor colors it: each token is a <span> with the class Emacs's htmlize gives its face (org-keyword, org-string, org-comment, org-function-name, org-type, org-constant, org-property-name, org-variable-name), and the page's stylesheet colors them with the theme's syntax- colors, light and dark. Other languages are exported plain; the language- class lets a script or stylesheet in #+HTML_HEAD highlight them. Noweb references are shown as written. Code references are covered in Links: labels come off the lines, -n and +n number them, and [[(name)]] links to the labelled line.

The block's :exports header argument decides what appears. orgstar resolves it as running the block would: from the #+begin_src line, #+HEADER: lines, header-args properties and #+PROPERTY: lines (see Code blocks). Without one, it is results for dot, plantuml, ditaa, gnuplot, latex and lilypond blocks, as their Org defaults set it, and code for other languages.

:exportsExported
codeThe code.
resultsThe block's existing #+RESULTS:.
bothThe code, then the results.
noneNothing.

A #+CALL: line exports its existing results, never the call itself; :exports code or none on the call, or in the header-args properties where the call is, exports nothing. An inline src_ block has :exports results by default: the {{{results(…)}}} after it is exported and its code is not. With :exports code the code is exported in <code> and the results are not; with both, both. An inline call_ never appears itself, and the {{{results(…)}}} after it is always exported, whatever :exports says, as in Org.

Other blocks and elements

OrgHTML
#+begin_example<pre>
=: = lines<pre class"example">=
#+begin_quote<blockquote>
#+begin_center<div class"center">=
#+begin_verse<p class"verse">=, lines and indentation kept
#+begin_export htmlIts contents, as they are
#+begin_export other formatsNothing
#+begin_commentNothing
#+begin_NAME, any other name<div class"NAME">= (a special block)
@@html:…@@Its contents, as they are; other back-ends' snippets are dropped
Plain, numbered and description lists<ul>, <ol>, <dl>; checkboxes as [X], [-], [ ]
Timestamps<time datetime"…">=
Inline tasks<div class"inlinetask">= with the title in bold
Dynamic blocksTheir contents
-----<hr>

Comments, drawers, property drawers, planning lines, clock lines and keywords are not exported.

Citations

HTML and Markdown export handle citations the same way; see Citations below.

PDF export

Export to PDF makes the HTML export into a PDF, laid out and split into pages by the system's web engine as printing does. It needs neither Emacs nor TeX, and works on iOS. The PDF has what the HTML export has: the title, the byline, the table of contents, colored code, tables, images and math (MathJax, which needs a network connection). For the page:

For typeset output with LaTeX's classes and packages, use Export to PDF with Emacs instead (see Exporting through Emacs).

Word, RTF and plain text

Export to Word, Export to RTF and Export to Plain Text make the HTML export into a document of that kind, as the system reads HTML: headings, emphasis, links, colored keywords and code, lists, and tables. Word files (.docx) are written by orgstar itself, so tables come through as Word tables; RTF keeps them too on the Mac. On iOS, where the system's HTML reader keeps no tables, Word's tables are made from the HTML export's tables, with header cells bold and the cells' text without its styles; RTF and plain text there have the cells' text but no table. Plain text is the same text without its styles: list bullets and table cells are kept, separated by tabs. Fonts are Helvetica Neue for text and Menlo for code, and the colors are the light ones. Images are not included.

For Org's own ASCII layout, with underlined headings and drawn tables, use Export to Plain Text with Emacs.

Copying as rich text

Copy as Rich Text (the command palette on the Mac, the Export menu on iOS) puts the selection, or the whole file when nothing is selected, on the clipboard as HTML, RTF and plain text. Paste it into Mail, Pages, Word or a web form to get the formatted text. On iOS it copies the whole file.

Markdown export

Markdown export writes GitHub-flavored Markdown:

As in HTML export, #+INCLUDE: lines are expanded and macros replaced first, and #+EXCLUDE_TAGS, #+SELECT_TAGS, COMMENT headings and ARCHIVE tags decide which headings are exported (see Which headings are exported). Of the #+OPTIONS, Markdown export reads todo, pri, tags, ^ and title; the others do not apply. It writes no author or date.

iCalendar export

iCalendar export writes the .ics file org-icalendar-export-to-ics writes, for calendar apps to read or subscribe to. Each heading can give:

SettingValuesDefault
org-icalendar-use-deadlineevent-if-not-todo, event-if-todo, event-if-todo-not-done, todo-due, separated by spaces"event-if-not-todo todo-due"
org-icalendar-use-scheduledthe same, with todo-start for todo-due"todo-start"
org-icalendar-include-todonil, t (tasks not done), all, unblocked (not done, without unfinished children, and not after an unfinished sibling under an ORDERED parent), or TODO keywords separated by spaces"nil"
org-icalendar-combined-agenda-filethe file Combine Agenda Files into iCalendar writes"~/org.ics"

The summary is the heading's title, or its SUMMARY property. The description is the heading's text as Org's ASCII export writes it, filled to 70 columns, or its DESCRIPTION property; LOCATION, CLASS, TIMEZONE and APPT_WARNTIME (an alarm, minutes before a timed event) are read too. CATEGORIES lists the heading's tags and its category. An ID property is the UID; a heading without one gets a new random UID each time, as in Org with org-icalendar-store-UID nil. Repeaters become RRULE lines. Times are local times without a zone, as Org writes them by default; a TIMEZONE property of UTC writes them in UTC, and any other value names the zone (TZID).

#+ICALENDAR_EXCLUDE_TAGS: lists tags whose subtrees are left out; #+EXCLUDE_TAGS: doesn't apply, so noexport subtrees are exported unless listed. #+SELECT_TAGS, COMMENT headings and ARCHIVE tags apply as in the other exports. #+ICAL-TTL: sets X-PUBLISHED-TTL, the refresh period, such as PT1H. The calendar is named after the file, its description is #+TITLE:, and its owner #+AUTHOR: or your full name. Lines longer than 75 characters are folded and lines end in CRLF, as RFC 5545 asks.

Export Agenda Files to iCalendar writes an .ics beside each agenda file (see The agenda). Combine Agenda Files into iCalendar writes all their entries to one calendar named OrgMode at org-icalendar-combined-agenda-file. On iOS, the Export menu's iCalendar shares the current file's calendar.

Differences from Org: diary sexps (%%(…) lines and <%%(…)> timestamps) are left out, as they need Emacs's icalendar.el. The other org-icalendar-* variables keep Org's defaults: alarms only from APPT_WARNTIME, categories (local-tags category), the whole body as the description, and local times. Descriptions of tables with column groups or alignment cookies, center blocks and links to targets can differ from Org's in layout.

Publishing

Publishing (org-publish) exports a folder of Org files to a folder of HTML or Markdown files, copies other files beside them, and can write a sitemap. Projects are [[publish]] tables in config.toml, as org-publish-project-alist entries are in Emacs:

[[publish]]
name = "notes"
base-directory = "~/notes"
publishing-directory = "~/public_html"
recursive = true
auto-sitemap = true
sitemap-title = "Notes"

[[publish]]
name = "static"
base-directory = "~/notes"
base-extension = "css\\|png\\|jpg"
recursive = true
publishing-directory = "~/public_html"
publishing-function = "org-publish-attachment"

[[publish]]
name = "site"
components = "notes static"
KeyValueDefault
nameThe project's namerequired
base-directoryThe folder of files to publish: absolute, ~/…, or relative to the first folder in the sidebarrequired
publishing-directoryWhere the published files go, the same wayrequired
base-extensionThe extension of the files to publish, an Emacs regexp such as ="css\\png", or =any"org"
recursiveFiles in subfolders toofalse
excludeAn Emacs regexp on the file's path under base-directory; matching files are left out
includeMore files, relative to base-directory, separated by spaces
publishing-functionorg-html-publish-to-html, org-md-publish-to-md or org-publish-attachment (copied as they are), several separated by spacesorg-html-publish-to-html
body-onlyThe export's body onlyfalse
auto-sitemapWrite a sitemap into base-directory and publish it with the restfalse
sitemap-filenameThe sitemap's name"sitemap.org"
sitemap-titleIts #+TITLE"Sitemap for project NAME"
sitemap-styletree (folders nest) or list"tree"
sitemap-sort-filesalphabetically (by title), chronologically or anti-chronologically (by #+DATE, else the file's date), or nil"alphabetically"
sitemap-sort-foldersIn a list sitemap: ignore (no folders), first, last or nil (mixed)"ignore"
sitemap-ignore-caseSort titles ignoring casefalse
componentsFor a project of projects: the projects' names, separated by spaces

Files whose names start with a dot are left out. An Org file publishes to the same path under publishing-directory, named by #+EXPORT_FILE_NAME when it has one, with links to other .org files pointing to their .html. The sitemap lists each file as a link with its #+TITLE (or its name), as Org's default sitemap does.

On the Mac, File ▸ Publish has the commands, which are also in the command palette:

CommandEmacs presetWhat it does
Publish Project…C-c C-e P xAsks for a project and publishes it (org-publish)
Publish All ProjectsC-c C-e P aorg-publish-all
Publish Current FileC-c C-e P fThe current file, in the first project that has it (org-publish-current-file)
Publish Current ProjectC-c C-e P pThe first project that has the current file (org-publish-current-project)

A file whose published copy is newer than it is skipped, as Org skips files that haven't changed; delete the copy to publish it again. The message area says how many files were published and how many were up to date. Differences from Org: preparation and completion functions, :makeindex, custom sitemap functions and the export options a project can set (:with-toc, :html-head and the rest) aren't read; set those with #+OPTIONS and the other keywords in the files, or a #+SETUPFILE. Publishing is on the Mac only.

Exporting through Emacs

On the Mac, PDF, LaTeX, ODT and plain text exports are done by Emacs, with the ox functions Emacs's dispatcher uses:

FormatFunction
PDForg-latex-export-to-pdf
LaTeXorg-latex-export-to-latex
ODTorg-odt-export-to-odt
Plain textorg-ascii-export-to-ascii

orgstar runs emacs -Q --batch in the Org file's folder. It opens the file, replaces its contents with the editor's current text without saving, and calls the function. Emacs writes the result beside the file, as it would itself; with a destination chosen in the export dialog, orgstar then moves it there. The message area shows "Exporting with Emacs…" and then "Exported to name".

What you need:

Things to know:

To use your own Emacs configuration, or formats orgstar does not list, export from Emacs itself; see Alongside Emacs.

Citations

HTML and Markdown export process citations as Org's basic citation processor does (oc-basic).

#+bibliography: refs.bib
#+cite_export: basic author-year

As shown in [cite:@smith2020], and again [cite/t:@smith2020; see @lee2019 p. 4].

#+print_bibliography:

Bibliography files

Each #+bibliography: line names one file, relative to the Org file, optionally in quotes. A file ending in .json is read as CSL-JSON; anything else is read as BibTeX, with @string abbreviations expanded and @comment and @preamble skipped. You can have several #+bibliography: lines; for a key in more than one file, the first file wins.

#+cite_export:

#+cite_export: PROCESSOR [BIBLIOGRAPHY-STYLE [CITATION-STYLE]].

Citation styles

A citation is [cite:…] or [cite/style:…] or [cite/style/variant:…], holding one or more @key references separated by ;. Each reference may have its own prefix and suffix, and the whole citation a common prefix and suffix.

StyleOutput
default (none given)(Author, Year)
author, aAuthor
noauthor, na(Year)
text, tAuthor (Year)
note, ftA footnote holding the text form
numeric, nb(1), numbered by the cited works sorted by author; three or more in a row as 1-3
nocite, nNothing; the work is still listed in the bibliography
VariantEffect
bare, bNo parentheses
caps, cCapitalized author
bare-caps, bcBoth

Works by the same author in the same year get a, b, … after the year. A key not found in any bibliography file shows as ?? and ????. Citations in the title are dropped.

For note citations, the blank before the citation is removed and punctuation right after it moves in front of the footnote mark, as org-cite-adjust-note does.

The bibliography

#+print_bibliography: is replaced by an entry for every cited work, sorted by author. The bibliography style from #+cite_export: sets the form:

Bibliography styleEntry
defaultAuthor (Year). /Title/, Publisher.
plainSurnames. Title, Publisher, Year.
numeric[1] Author, /Title/, Publisher, Year.

The publisher part comes from the publisher, journal, institution or school field. Without #+print_bibliography: no bibliography is written.

What export does not do