Non-HTML formatted posts

28 views
Skip to first unread message

Paul Stovell

unread,
Jan 29, 2011, 12:55:12 AM1/29/11
to blogml-...@googlegroups.com
Most blog engines assume every post is HTML. In FunnelWeb, we encourage people to use Markdown, which lets us format the posts much more consistently. 

When we export, there's no way to indicate that the post content is Markdown or HTML. There is a "type=text" attribute, but I don't think it's the same thing, and it isn't exposed as a settable property in the .NET API. 

It would be nice to specify the post content multiple times - e.g.,:

<Content Format="Html"><<[CDATA[<strong>Hello, blah blah...</...>
<Content Format="Markdown"><<[CDATA[**Hello, blah blah...**</...>

An exporter should export as many formats as possible, and an importer should be able to pick its favorite format for importing. 

How could we standardize on an extension to indicate the format, and how can we make it backwards-compatible?

Paul

dneimke

unread,
Jan 29, 2011, 2:02:08 AM1/29/11
to blogml-...@googlegroups.com
How would that play out Paul?  Presently, content types are used to describe the content for Posts, Post Excerpts, and Comments.  Each of those has a 1-1 relationship to a Content Type.  For example talk me through what you are suggesting in terms of the following fragment of code:

var post = new  BlogMLPost() ;
post.Content = BlogMLContent.Create(yourText, ContentTypes.???)

It may be worth looking at the code for the following:

dneimke

unread,
Jan 29, 2011, 2:18:55 AM1/29/11
to blogml-...@googlegroups.com
The BlogMLContent class is the most important one to look at as it is the ultimate storage unit for the content.  As you can see from the content types, today there are four standards for content: html, xhtml, text, base64.

There are two parts to content, the format, and the encoding.  Today the format and the encoding are hard-wired into some our helper class.

In the simplest form, I think what you are proposing would be to add another content type attribute: "markdown".  Is it that simple?  

Paul Stovell

unread,
Jan 30, 2011, 6:20:16 PM1/30/11
to blogml-...@googlegroups.com
Hi Darren,

The part that confused me is that the BlogML Sample files (BlogML20Sample.xml, etc.) use type="text" even for HTML content - 

      <content type="text"><![CDATA[<p>Any web application needs a way to send emails to different kinds of its users.&nbsp; This capability 

Adding type="markdown" support would be the first step. 

The second step would be to make content a repeating element. For example:

<post...>
   <content type="text"><![CDATA[Hello world...
   <content type="html"><![CDATA[<strong>Hello world...
   <content type="markdown"><![CDATA[**Hello world...
</post>

In the above snippet, my exporter was smart enough to encode the content in three different formats. That allows an importer to choose the least "lossy" format - if a blog supports Markdown, it could import that, or it could fall back to HTML or plain text. 

In the XML schema, you should just be able to make maxOccurs of the content element > 1. 

From a .NET API perspective, content would become a collection:

post.Content.Add("text", "Hello world");
post.Content.Add("html", "<strong>Hello world</strong>");
post.Content.Add("markdown", "**Hello world**");

Paul
Reply all
Reply to author
Forward
0 new messages