I'm quite new to blogging and have recently discovered Windows Live Writer. I've downloaded various plugins for code formatting but none provided me with what I wanted:
- The ability to format the code 'live'
- The ability to wrap lines
- The ability to change the background color
- The ability to just quickly paste what's in the clipboard as code
The plugin I implemented formats and highlights code and also does all the above. Here's a screen shot of it in use:
Here you can see that the content editor on the right can change the tab width, background color, language, and line numbers.
Below are some sample of code used with the plugin.
Here's some C# code:
public int TabWidth
{
get
{
return _content.Properties.GetInt( @"TabWidth", 4 );
}
set
{
_content.Properties.SetInt( @"TabWidth", value );
}
}
and some XML markup...
<Triggers>
<KeyPressTrigger Key="PropertyListTrigger" Character=" ">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="PropertyState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>
<KeyPressTrigger Key="ValueListTrigger" Character=" ">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="ValueState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>
</Triggers>
I've made available the source and the binaries for this plugin.
To use it, extract the binaries to \Windows Live Writer\Plugins and run WLW. The source is in C# 2.0 and comes with a Visual Studio 2005 solution.
Note that the .NET 2.0 Framework must be installed before this plugin will work.
Going forward
I plan to put this plugin onto CodePlex (if they let me!). I also plan on making a few additions to the defaults via the Options screen. New languages can easily be added too thanks to the great ActiPro Code Highlighter. I'd also like to thank Christophe De Baene for his syntax highlighting tool. It's a great plugin and also helped me understand how to use the ActiPro control.
Please let me know if you'd like to contribute on CodePlex or if there are any features you'd like to see at steve at dunnhq d.o.t. com
97 comments:
Steve,
I added your plugin to my Windows Live Writer plugin list:
http://jeftek.spaces.live.com/blog/cns!F2042DC08607EF2!610.entry
Great! I just found some minor issues.
http://jtbworld.blogspot.com
"One problem I run into is that I'm not able to use the word wrapping. It looked OK in the Normal Layout but in the Web Layout it was not nice. The width was just a hand full characters and could not be resized. Another thing is if editing the code use CTRL+Enter to add a row since Enter will trigger the OK button."
I added an image showing the problem to the post on my site. If you don't see this effect could it be something with my blogger template?
Hey,
We have a WorkSpace for WLW plugins on CodePlex and will be glad to see ya there:
http://www.codeplex.com/Wiki/View.aspx?ProjectName=WLWPlugins
This guy has already done the same thing without the use of third party software
http://www.wilcob.com/Wilco/Toolbox/SyntaxHighlighter.aspx
might be worth getting him involved.
Hey
Absolutely cool tool. Already using it heavily in my blog.
But just figured out one issue with Wordpress. If I have word wrap enabled and then I edit it in Wordpress the whole structure kinda falls appart. I put an example into my blog:
http://remy.supertext.ch/?p=7
Here is an example of the formatter with a couple of painful edits to the HTML. It shows how to turn on the scrollbars and the sizing of the control. This is necessary to prevent the lines from wrapping which will disrupt copy/paste of code in many weird ways.
It would be nice to have a copy button inserted that would force the clipboard copy to done as text and not HTML. This is what most code sites do with code snipettes. Yor control would make all of this very simple and straight-forward.
Thanks
http://tech-comments.blogspot.com/2006/10/live-writer-steve-dunns-code-formatter_03.html#links
Excellent work man, I would like to help you with it, upload it in someplace like codeplex and let me help. BTW, I found some troubles with special characters as \ or " with PHP code in wordpress.
Hey, I can't seem to be able to change the font of the code. Anyone knows how to do that, maybe?
Nice design of blog.
Great to see this! Thanks!
1
Thanks for article!
I like articles like this. Thanks!
Thanks for article! Very interesting.
Do you can write anything else about it? Great article!
like articles like this. Thanks
viagra Online store
Viagra
Generic Viagra
Google
Cialis
-------------------------------------------------------
Levitra
Propecia
Meridia
Yahoo!
-------------------------------------------------------
Zocor
Soma
Prozac
Indulge yourself and find partners for hot Sexual Encounters and Adult Dating at Adult friend finder free dating site!
If you are looking for a one night stand or a casual encounter, then the Adult Swingers Club is where the game is played.
If you practice a different range of sexual and sensual activities then adult personals has the Club for you.
Download over 2000 adult dvd movies, available formats: windows, mpeg, psp and ipod!
Shop for Adult Toys, DVDs and Lingerie and other Erotic Adult Products at adult sex toys shop.
bNadZ4 You have a talant! Write more!
QBlGyl Thanks to author.
4CDoAM The best blog you have!
pHe6Sk Good job!
Please write anything else!
Please write anything else!
Wonderful blog.
Magnific!
Wonderful blog.
Hello all!
Thanks to author.
Good job!
Nice Article.
zhq7tj write more, thanks.
Nice Article.
Please write anything else!
Hello all!
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
Hello all!
Wonderful blog.
Good job!
Please write anything else!
Please write anything else!
Wonderful blog.
Good job!
Wonderful blog.
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
I'm not a complete idiot, some parts are missing!
Beam me aboard, Scotty..... Sure. Will a 2x10 do?
Friends help you move. Real friends help you move bodies
A lot of people mistake a short memory for a clear conscience.
What is a free gift ? Aren't all gifts free?
Build a watch in 179 easy steps - by C. Forsberg.
Give me ambiguity or give me something else.
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
All generalizations are false, including this one.
I'm not a complete idiot, some parts are missing!
Oops. My brain just hit a bad sector.
Lottery: A tax on people who are bad at math.
A lot of people mistake a short memory for a clear conscience.
Energizer Bunny Arrested! Charged with battery.
Please write anything else!
A flashlight is a case for holding dead batteries.
What is a free gift ? Aren't all gifts free?
Calvin, we will not have an anatomically correct snowman!
Oops. My brain just hit a bad sector.
All generalizations are false, including this one.
I don't suffer from insanity. I enjoy every minute of it.
Ever notice how fast Windows runs? Neither did I.
What is a free gift ? Aren't all gifts free?
Oops. My brain just hit a bad sector.
The gene pool could use a little chlorine.
Friends help you move. Real friends help you move bodies.
Thanks to author.
Change is inevitable, except from a vending machine.
640K ought to be enough for anybody. - Bill Gates 81
Thanks to author.
If ignorance is bliss, you must be orgasmic.
A flashlight is a case for holding dead batteries.
I'm not a complete idiot, some parts are missing!
Clap on! , Clap off! clap@#&$NO CARRIER
If ignorance is bliss, you must be orgasmic.
The gene pool could use a little chlorine.
Wonderful blog.
I don't suffer from insanity. I enjoy every minute of it.
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
Save the whales, collect the whole set
Good job!
Beam me aboard, Scotty..... Sure. Will a 2x10 do?
The gene pool could use a little chlorine.
What is a free gift ? Aren't all gifts free?
Save the whales, collect the whole set
640K ought to be enough for anybody. - Bill Gates 81
I'm not a complete idiot, some parts are missing!
All generalizations are false, including this one.
What is a free gift ? Aren't all gifts free?
You've got a great picture to illustrate your text, and you know exactly
where you want it to be positioned. When you insert the picture, however,
it can not be moved or floats off the page or seems to be cut off, which
is not what you had in mind.When a picture is inserted into your Word document,
its default placement is In Line With Text. That is, Word inserts the picture
where your cursor is, even though it may not be aligned properly with the text
around it. Many times, however, you will want to change the way that text wraps
around your image.
If you want to reposition your picture choose from these options:learn more
boys not ready for college
You've got a great picture to illustrate your text, and you know exactly
where you want it to be positioned. When you insert the picture, however,
it can not be moved or floats off the page or seems to be cut off, which
is not what you had in mind.When a picture is inserted into your Word document,
its default placement is In Line With Text. That is, Word inserts the picture
where your cursor is, even though it may not be aligned properly with the text
around it. Many times, however, you will want to change the way that text wraps
around your image.
If you want to reposition your picture choose from these options:
learn more
Post a Comment