I wrote a WLW PlugIn to paste from a console. You can download it from the Gallery here. The setup program needs Live Writer Beta 3. It will:

  1. Enclose the text in <pre> tags so that it has that wonderful console look (fixed-width font)
  2. optionally use a heuristic to remove line-breaks inserted for word-wrapping.
  3. optionally format the console prompt and input differently than the output, making it easier to read.

 

This can be pretty handy for a technical blog where you paste console instructions.

For example, here's some simple output from a cmd.exe session that compiles and runs a random program, and then prints a long line of text (wrapping at 80 characters). Normally pasting it looks like:

C:\temp>csc a.cs b.cs /debug+
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.1378
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

C:\temp>b.exe
3

C:\temp>echo 123456789_123456789_123456789_123456789_123456789_123456789_1234567
89_123456789_
123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_

C:\temp>

With Paste-From-Console, it looks like:

C:\temp>csc a.cs b.cs /debug+
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.1378
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.


C:\temp>b.exe
3

C:\temp>echo 123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_
123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_

C:\temp>

 

This is my first Writer PlugIn to use the IProperties interface to persist PlugIn options. It has options to:
- toggle line-breaks on and off.
- set the width at which to remove line breaks (default is 80).
- disabling colorizing the input prompt.
- change the regular expression used to match the input prompt.
- change the HTML formatting for the prompt and input.
- set the containing HTML that the text is surround in. "<pre>{0}</pre>" is a nice start, but the default also includes a simple border around it.


It has some limitations:
- the line break removal is just a heuristic (which I mitigate by allowing you to disable it)
- doesn't pick up colorized output from the console itself (everything is picked up as plain Text)