Some Notes on Formatting Blog Posts Using Org2blog

This post contains some notes on formatting blog posts using org2blog.

This is the second blog entry in a tutorial on posting using org2blog in Emacs.

  1. How I made my first blog entry How to get started with org2blog in Emacs, and to create create blog entries on WordPress.
  2. Some notes on formatting blog posts using org2blog Instructions how to format, and to create diagrams using Emacs org -mode
  3. Customize WordPress: Understand how to configure WordPress, and how to write blog entries in order to make blog more easily approachable

Creating Table of Contents

Table of contents is created using a #+TOC -directive. For example, this post uses

#+TOC: headlines 1

to create table of contents for headings on level 1.

Links and Font Styles

The paragraph

Consult org manual on font styles for more instructions on using bold, italics, or verbatim styles.

was created using the following text in org-buffer

Consult [[][org manual on font styles]] for instructions to for using
*bold*, /italics/, or =verbatim= styles.

Adding Source Code

Structural element #+BEGIN_SRC adds source code, for example

#+BEGIN_SRC ruby
  def hello
    puts "Hello world"

results to

def hello
  puts "Hello world"

See org manual on literal examples for more details

Diagrams and Drawings

Ascii Art and Ditaa

Emacs-fu has a nice blocg post documenting Emacs picture-mode. The post also covers artist-mode, and explains how to use ditaa to convert Ascii art into proper bitmap graphics.

In short, use

  • <s <TAB> to create #+BEGIN_SRC element block. (See org manual on easy templates for explanation, and more examples for generating blocks in org-mode)
  • M-x picture-mode to enter into picture -mode
  • control cursor movements C-c <Up Arrow>, …
  • C-c C-c to resume back to org -mode

For example, an Ascii art block

#+BEGIN_SRC ditaa :file images/hello.png

| 		 |
| Hello World!	 |
|		 |


is converted to hello.png image.

Hint 1: To minimize bitmap generation overhead, use a separate buffer for ditaa drawings, use C-c C-c to generate bitmap, and embed [[./images/hello.png][]] the generated image file into the post.

Hint 2: To generate all pictures in the buffer export it to HTML scratch buffer (C-c C-e hH).

Hint 3: to create link to image instead of embedding, use description text in org link -element. For, example

[[./images/hello.png][link to image]]

Graphviz Diagrams

Following code

#+BEGIN_SRC dot :file ./images/hellodot.png  :cmdline -Kdot -Tpng

  digraph {
          Hello -> Dot


results to hellodot.png.

Notice: dashes are not allowed in the file name (at least in my setup).

Including Files

Other files may be included using #+INCLUDE: directive. For example,

#+INCLUDE: "./2015-05-13"

includes following content

Header in included file

Included file imported a picture



2 thoughts on “Some Notes on Formatting Blog Posts Using Org2blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s