Scott Hanselman

NuGet Package of the Week: MarkdownLog makes log files much prettier

July 30, 2014 Comment on this post [4] Posted in NuGet | NuGetPOW
Sponsored By

While I'm not 100% gaga over Markdown as I know many of you are, I definitely appreciate it's usefulness and it's clarity. Some folks would say I shouldn't rest until every binary document on my hard drive has been converted to Markdown. I say, nay nay. That said, I totally dig MarkdownPad and you should use it every day. It's lovely.

If you don't want to install anything, check out and quickly edit some Markdown in the browser.


But, I digress.

Note: Be sure to check out all the NuGet packages of the week! There's more!

The general idea behind Markdown is that HTML is way too complex for 90% of what you need, so rather than <ul> and <li> and all that, why not just express bullets with asterisks? We can all get behind that. There are many other simple Markdown syntaxes that you can learn in a few minutes. Once you've created some Markdown, you can easily generate PDFs, HTML, Word Documents, whatever you like.

Recently I stumbled upon Stuart Wheelwright's article on Using Markdown for Effective Logging over at CodeProject. Here's the first image borrowed from his excellent article where he clearly shows why Markdown is simpler than HTML:


Stuart has taken Markdown and created a wonderful little library called MarkdownLog. It's a brilliant little idea that one of us should have come up with first! Kudos to Stuart. ;)

[MarkdownLog] is designed to make it trivial to produce Markdown formatted text from an application's data structures. Using just one line of code, a collection of .NET objects can be output as a table or list. And, because the output is Markdown, it can later be converted to HTML for publishing, if needed.

Even better, MarkdownLog is a Portable Class Library (PCL) and can be used with any .NET platform, including iOS with Xamarin. In fact, it's an iPhone app written with Xamarin that compelled Stuart to write MarkdownLog.

Here's one of his first examples. This C# code:

var myStrings = new[] { "John", "Paul", "Ringo", "George" };

Gives you this simple Markdown.

   * John
* Paul
* Ringo
* George

At this point, you are likely unimpressed. But wait! There's more! There's a whole series of nice extension methods that make it easy to create templates from objects of any shape. Here's another example of his:

var data = new[]
new{Name = "Meryl Streep", Nominations = 18, Awards=3},
new{Name = "Katharine Hepburn", Nominations = 12, Awards=4},
new{Name = "Jack Nicholson", Nominations = 12, Awards=3}


This gives you a Markdown table, of course. This looks nothing like an HTML table, but remember, Markdown is source code that can be translated into other formats like HTML and PDF.

 Name              | Nominations | Awards
----------------- | -----------:| ------:
Meryl Streep | 18 | 3
Katharine Hepburn | 12 | 4
Jack Nicholson | 12 | 3

Be sure to explore the full CodeProject article and the home page for MarkdownLog. Think about how you could add this to your existing logging framework and create better logs for tests, builds, anything. Take a look at the HTML render of one of Stuarts's Test Suite Runs and tell me that you want immediately want to get to work updating your old .LOG files.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
July 30, 2014 20:57
WebEssentials has some nice Markdown features too.
July 30, 2014 22:10
While I see the use of Markdown for things like code blocks with syntax highlighting, I don't see the benefit for simple cases like lists and tables. In fact, authoring a table in Markdown syntax seems way more annoying than writing the equivalent HTML.
August 17, 2014 21:08
You can consume the polk salad leaves that way, or drain and toss
in a skillet using a couple of teaspoons of bacon drippings and stir fry them for about one minute.
For mild to moderate psoriasis, topical creams will be the treatments of choice.

Acai berry contains important antioxidants called Anthocyanins which eradicate toxins within us to keep the body
functioning. The five leaves on each stem should really symbolize the elements in perfect harmony.

Last week I met among my friend, He is also a fantastic article writer and write articles
for a number of web development companies.
Make each paragraph intriquing, notable and appealing with a fresh supportive idea
which could possibly be a connecting link to the idea in the previous paragraph.
Phytolacca decandra whether ([]( "")) You don't need to be an highest rated writer to write down effectively to the
extent of having your individual original articles published on article directories for the internet.
You can, as an example, choose to create about your role model and just how he
or she has helped you deal together with your disability.
October 17, 2014 6:50
It should be taken the whole year, before and after
the workout program is done, as well as at the start of the day and
during those days when you are not in the gym. Then bending at
the knees and hips you lower the barbell down until your thighs are almost parallel to
the floor. Bodybuilding nutrition is quite simple, there are Proteins Carbohydrates and fats and your
nutrition approach would need to contain balance of all, siding with slightly more protein to recover and gain the muscle.

Also visit my page no nonsense muscle building guide
discount ([]( ""))

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.