Subscribe to the RSS Feed

Paradox - a statement or proposition that seems self-contradictory or absurd but in reality expresses a possible truth.

:: BINARY PARADOX ::

Stepping stone to the /dev/null in the sky

High-speed note taking with Textile

It’s no secret that I’m a Computer Science student. From this you can infer a couple of things fairly reliably:

  1. I have terrible handwriting
  2. I take class notes frequently
  3. My computer spends enough time with me that it might as well be an appendage
  4. I’m lazy and want to script away anything mundane

These factors eventually led me to experiment with various strategies to allow me to take notes on the computer (solving the handwriting and frequent note issues) while at the same time maintaining a low level of effort.

I started by taking notes in OpenOffice/MS Word but found that this was exceptionally annoying. All I was ever doing was creating bulleted lists, numeric lists, various heading sizes, and some minor stylistic effects like bolding and italics. I became proficient enough with the keyboard shortcuts that I could do it with modest speed, but it was becoming clear that OpenOffice was overkill. I eventually ended up using a EEEPC Netbook for the majority of my class time and the 1 gigabyte of RAM was being squandered on this large word processing app. It was also really annoying to try and find specific notes later. There was no easy way to search the content from the command line using grep or the other utilities I’m familiar with.

This led me to writing notes in plaintext format. I’d use indentation and some simple conventions to indicate different things. This was great in the sense that I was able to write the notes very quickly (certainly a factor to consider as a lecturer flies through material as fast as they can get the words out). The flat text file approach was easy to search, easy on RAM, and fast! Using my favourite text editor (VIM) I was able to have spellchecking and little requirement for a mouse or GUI.

Of course flat text files were exceptionally plain. They lacked all of the stylistic elements and visual cues that made the OpenOffice notes nice to study from. I needed something that was the best of both worlds. Around the same time I reached this conclusion I had converted this Website to the TextPattern CMS The content in this CMS is built around a very very simple wiki-like mark-up called Textile . It was perfect for my website content. I could put asterisks around text to bold it, indicate header levels with a few characters at the start of a line, and create tables quickly by just drawing their rough structure with plain ASCII around the cell contents. You can experiment with Textile yourself as the comment form at the bottom of each article/page allows a slightly more limited subset of Textile.

After some research I realized that I could build a script that would process my raw text files written in VIM into XHTML with all of the wonderful visual cues I needed. I found a Python binding for the Textile engine and started to get to work. The result of an afternoon of Python hacking is the note_converter.py script that you’ll find at the bottom of this page.

It meets all of my requirements, and it might meet yours. Feel free to download the script (requires Python 1.6 and the PyTextile library). The source is pretty clean and well commented, though it’s one of my first forays into bin commands in Python. Remember to chmod +x the script before trying to run it. Running it with no arguments will print the help and available arguments.

For my own purposes I create a directory for each class with my txt Textile notes in it. I also include a html template file with the magic content replacement string inside it so that I can have a consistent CSS and header/footer for each course.

Future plans include writing a Vim extension to add the script as a command able to be run easily from within Vim while editing a textile note file. Stay tuned!

Download the note_converter.py script

EDIT After some prodding I’ve included an example of what the textile markup looks like and what it comes out rendered as.

The following is the textile markup you’d create in your editor of choice. It’s super simple and really easy to pick up.

h2. A title
h3. A subheading

p. A paragraph with some *bold* text, some _italics_. Etc, etc
bq. Block quote! Oh gnoes! Where is the reference???

p. Todo List:
# Learn LISP
# ???
# Profit!

p. Mixed multi-level list:
* A point
** How rare!
* Point two
*# Zombies
*## Brain eating zombies

* Vampires
# Day walkers
# Sparkly ones
* What was the point of this again?

p. How about a link? "I like links!":http://slashdot.org

p. Tables are easy too!
|_. Name |_. Awesome |
| Dan | Yes |
| Other | No |

p. And finally, of course... code: @System.out.println("Hello World!");@

It will then render as (well, without my website stylesheet’s effects) as:

A title

A subheading

A paragraph with some bold text, some italics. Etc, etc

Block quote! Oh gnoes! Where is the reference???

Todo List:

  1. Learn LISP
  2. ???
  3. Profit!

Mixed multi-level list:

How about a link? I like links!

Tables are easy too!

Name Awesome
Dan Yes
Other No

And finally, of course… code: System.out.println("Hello World!");


Transmissions:

  1. Dear Sir,

    You are an inspiration!
    I very much enjoyed reading this.
    Your thought process is remarkable.

    Sincerely,
    Carm A.

    — Carm A. · Mar 10, 02:10 PM · #

  2. Why don’t you post a couple of examples as I am lazy and don’t want to try this myself!

    Dan

    — Dan K · Mar 10, 04:12 PM · #

  3. @Dan K

    Done and done. Examples at the bottom of the post now.

    Daniel · Mar 10, 07:58 PM · #

  4. I think one day you will shed your skin for everyone to see your inner circuits.
    An interesting read, but I think I’ll keep up with Word, I’ve learned all the shorcuts and mastered the program.
    Keep up the good work, and make sure you always abide by Asimov’s laws.

    — Dannie · Mar 10, 09:43 PM · #

  5. Asimov’s “laws” are simple guidelines. And he wrote a series of delightfully amusing stories about how his laws get robots into trouble. Nay, the real way to do it is to head back to your space lab (in space) and build your army of cyborgs. You know; start from ground zero and work your way up to general guidelines about how robots should behave.

    Invariel · Jun 4, 03:44 PM · #

Begin Transmission:

Add your thoughts, preview and then submit

Please note, your comment will not appear until after it has been moderated & approved. Sorry!


Hidden


Textile Help

You may also be interested in...