org-asciidoc icon indicating copy to clipboard operation
org-asciidoc copied to clipboard

An org-mode exporter backend for AsciiDoc

[[https://melpa.org/#/ox-asciidoc][file:https://melpa.org/packages/ox-asciidoc-badge.svg]] [[https://github.com/yashi/org-asciidoc/actions][file:https://github.com/yashi/org-asciidoc/actions/workflows/tests.yml/badge.svg]]

  • org-asciidoc

An Org Mode Exporter Backend For AsciiDoc and Asciidoctor

  • Setup

    1. Make sure you have org-mode v8.0 or later
    2. Clone this repository
    3. Add the following to your .emacs #+begin_src lisp (add-to-list 'load-path "~/path/to/org-asciidoc/") (require 'ox-asciidoc) #+end_src
    4. open a .org file and run =org-asciidoc-export-as-asciidoc=
  • AsciiDoc specific attributes

AsciiDoc backend understands the following attributes in a =ATTR_ASCIIDOC= line.

** Source Code Blocks

  • :asciidoctor-diagram :: Export a source code block as an [[https://docs.asciidoctor.org/diagram-extension/latest/][Asciidoctor Diagram]]. Set it as ~t~ to generate a listing block for an asciidoctor diagram.

    If you are using Org v9.6 or earlier, make sure to set ~:exports~ to something non-standard, such as ~diagram~. This allows us to get ~:file~ parameter in the exporter.

    e.g) #+begin_src org ,#+ATTR_ASCIIDOC: :asciidoctor-diagram t ,#+BEGIN_SRC ditaa :file images/hello-world.png :exports diagram +--------------+ | Hello World! | +--------------+ ,#+END_SRC #+end_src

** Tables

  • :width :: a percentage value to specify the table width with in the current column. Valid values: 1...99.

    e.g) #+begin_src org ,#+ATTR_ASCIIDOC: :width 50 | Name | Phone | Age | | Peter | 1234 | 17 | | Anna | 4321 | 25 | #+end_src

  • :pgwide :: a boolean value to specify the table should be column width or full page width in multi-column setup. Valid values: ~t~ or ~nil~.

    e.g) #+begin_src org ,#+ATTR_ASCIIDOC: :pgwide t | Name | Phone | Age | | Peter | 1234 | 17 | | Anna | 4321 | 25 | #+end_src

  • org-publish

    If you want to use org-publish with ox-asciidoc, setup your org-publish-project-alist like this:

    #+begin_src lisp (setq org-publish-project-alist '(("my-proj" :base-directory "/tmp/my-dir" :publishing-directory "/tmp/pub-dir" :publishing-function org-asciidoc-publish-to-asciidoc))) #+end_src