This project is read-only.

Getting Plain Text

Sep 30, 2011 at 3:26 PM

I'm creating a simple admin dashboard for a web site which allows the admin to write news articles. I would like the home page to have a truncated summary of the news article, in plain text. The detail page for the news should be rendered with all the custom formatting as usual. Is there a way to ask the WikiEngine to render to plain text?

Sep 30, 2011 at 3:41 PM

Not out of the box. What we do in CodePlex, is have a set of plain text renderers that instead of format the appropriate content into html, it just spits out the plain text content. When you call Render, just pass in those renderers.

Sep 30, 2011 at 3:42 PM

Any chance you can add those plain text renderers to source? I'd hate to have to write all those from scratch and duplicate the work you've already done.

Sep 30, 2011 at 3:46 PM

Let me work on it, I don't think it'll be that hard. Though it adds a new dimension of "renderer sets" that I haven't thought of previously.

Sep 30, 2011 at 7:38 PM

Okay, I decided against a renderer set, and just added a PlainTextRenderer. To use it, simply do the following

var engine = new WikiEngine();
var result = engine.Render(input, new[] {new PlainTextRenderer()});

If you find any oddities in its output, please let me know.


Sep 30, 2011 at 8:25 PM

Thanks for getting that in! This should work perfectly.