Make your Google Chat Log Markdown Friendly

I am using Unfuddle for keeping some of my projects organised, and recently wanted to push a chat log into a unfuddle notebook so it could be discussed and reviewed by other people on the project. In unfuddle I am using Markdown syntax, which I think is fantastic. Formatting a Google chat log by simply copying and pasting from my gmail account into Unfuddle, however, needs a little help.

The trick here is to call on your old friend, regular expressions. There are a few things you need to do to make it all look pretty. In my case, I wanted to have line breaks where they appeared in the chat log, the time entries displayed in italics and the chat participants names bolded.

So without further ado; using your favourite regular expression powered text editor run the following regular expressions (you will probably need to break them into component parts to run them):

Step 1 – Get Linebreaks into the chat log
2 Spaces required at the each of every line to tell markdown to insert a line break:

/(.)$/$1 /g

Step 2 – Italicise the time markers
*blah* instructs markdown to italicise the text:

/(\d{1,2}\:\d{2}\s(A|P)M)/*$1*/ig

Step 3 – Bold the participants names
**blah** instructs markdown to bold the text:

/((\*|M|^)\s\w+\:)/**$1**/ig

That oughta do it. You can now drop your chat log into any markdown syntax enabled tool (including unfuddle).

Leave a Reply