# IRC Transcripts in Instiki and Markdown

**URL:** <https://www.ruby-forum.com/t/irc-transcripts-in-instiki-and-markdown/107588>\
**Category:** Ruby\
**Created:** [June 23, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/irc-transcripts-in-instiki-and-markdown/107588 "2007-06-23T19:21:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![levander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed655f/32.png) [@levander](https://www.ruby-forum.com/u/levander)\
**Post date:** [June 23, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/irc-transcripts-in-instiki-and-markdown/107588/1 "2007-06-23T19:21:57Z")

</div>

I haven’t found a way to easily markup IRC transcripts in Markdown on  
my Instiki install yet. Hopefully this isn’t a reason to go through  
all my wiki pages and switch to Textile.

For an IRC transcript like this:

M P r marks all the articles in the region with #  
 M-& makes the next command apply to all marked articles  
 M-U removes all marks (like the read mark)  
 in gnus you can mark articles with # when you want commands  
to  
apply to more than one article  
 the mark will disappear after the command is executed

The best markup I’ve found is to simple wrap the text in

```
,
```
  
tags. However, the usernames between the \<, \>'s always disappear when  
rendered in HTML. Is the only way to get the usernames not to  
disappear is in HTML is to replace the \<, \>'s with \<, \>'s? Can  
I get Markdown do that for me?

---

<div class="post-metadata">

**Author:** ![levander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed655f/32.png) [@levander](https://www.ruby-forum.com/u/levander)\
**Post date:** [June 24, 2007, 12:30am UTC](https://www.ruby-forum.com/t/irc-transcripts-in-instiki-and-markdown/107588/2 "2007-06-24T00:30:59Z")

</div>

Thanks rking. Indenting every line 4 space in the IRC transcript did  
work. Guess I just didn’t want to do it that way because I wanted to  
be able to copy and paste the whole transcript in without any  
formatting.

Guess I’ll just have to use a fully-featured text editor to indent it,  
then copy and paste it into instiki from there.

---

<div class="post-metadata">

**Author:** ![levander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed655f/32.png) [@levander](https://www.ruby-forum.com/u/levander)\
**Post date:** [June 23, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/irc-transcripts-in-instiki-and-markdown/107588/3 "2007-06-23T21:40:41Z")

</div>

On Jun 23, 10:15 am, levander [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is the only way to get the usernames not to disappear is in HTML is to replace the \<, \>'s with \<, \>'s?

You definitely need to escape them one way or another.

If you want to do it all in ruby, this will do it:  
require ‘cgi’  
CGI::escapeHTML(irc\_log)

> Can I get Markdown do that for me?

According to [Daring Fireball: Markdown Syntax Documentation](http://daringfireball.net/projects/markdown/syntax#precode)  
you can start each line with a tab to get both

```
text and HTML
escaping. From ruby do irc_log.gsub(/^/,“\t”)

Does either solution work for you?
```

---

<div class="post-metadata">

**Author:** ![levander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ed655f/32.png) [@levander](https://www.ruby-forum.com/u/levander)\
**Post date:** [June 24, 2007, 3:36am UTC](https://www.ruby-forum.com/t/irc-transcripts-in-instiki-and-markdown/107588/4 "2007-06-24T03:36:14Z")

</div>

On Jun 23, 3:27 pm, levander [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks rking. Indenting every line 4 space in the IRC transcript did  
> work. Guess I just didn’t want to do it that way because I wanted to  
> be able to copy and paste the whole transcript in without any  
> formatting.
> 
> Guess I’ll just have to use a fully-featured text editor to indent it,  
> then copy and paste it into instiki from there.

Not to plug my own war3z, but it was exactly things like that that  
moved me to write `clipfilter`, which is distributed with Clipboard.pm  
(which I vaguely intend on rubifying). Available at:  
[http://search.cpan.org/~king/Clipboard-0.09/](http://search.cpan.org/~king/Clipboard-0.09/) (it should work using  
native calls in Windows and OSX, and use the `xclip` program under  
Unices)

If you create a script like this:  
#!/bin/sh  
ruby -pe ‘sub(/^/, " "\*4)’

and put it in $PATH with a name of, say, 4spaces, you can then run:

clipfilter 4spaces

This will pipe the current clipboard contents to the listed program  
and then take the output to be the new clipboard contents.

You might want to speed the access to this, such as an alias (like  
“c4”), bind it to a keyboard shortcut, or maybe make a launcher/icon  
thing.
