Hi Tobias,
Thx for starting the topic.
>Also, would a server.content-type meaningfully be specified as "text/
>markdown"?!?
IMO it needs to be "text/x-markdown" [1]
FND is using this type allready at his playground [2] for tweeting.
See the random number titles "field". TiddlySpace server uses this
type to create a rendered HTML version. The whole stuff seems to be an
"unpromoted feature". ...
BinaryTiddlersPlugin.js [3] contains some stuff, that renders
"server.content-type" in a "special way". Especially the
"isTextual" [4] function imo needs some refactoring. (more on this
later *)
BinaryTiddlersPlugin.js can give you a hint, how you could handle
markdown. But all of this stuff seems to be rather hacky, to me.
That's why I suggested to start a topic, here in dev group.
There should be a solution, that can deal with hopefully "all" content-
types.
=====
*)
isTextual() [4] checks, if a content-type starts with "text/" and some
other textual indicators, and renders the stuff inside an HTML <pre>
element. Which is quite nice for TS because you don't need to deal
with {{{...}}} inside the tiddler. But it introduces some
inconsistencies too.
The problem I focused is:
"text/x-tiddlywiki" is textual, but should _not_ be covered inside a
<pre> element. It needs to be rendered, since it is TiddlyWiki markup.
"text/x-markdown" is textual as well. But if a plugin is available, it
should be rendered as markdown html. -> Same problem.
=====
I use some bits of BinaryTiddlersPlugin with my CodeMirror [5] stuff.
But since it interferes with "server.content-type" I used a field
"content-type". Having two content-types, turns out to be quite
usefull. Even if it may be wrong. (That should be an other topic)
Handling "server.content-type" and or "content-type" propperly faces
some more problems:
a) BinaryTiddlersPlugin needs to check for tag: systemConfig [7] and
isLink()
b) I need to check if a tiddler contains "{{{" or "<code" [6].
Because if so, it needs special handling as well.
Problems a) and b) point out, that this mechanism, needs some
rethinking at all, because too many edge cases have to be checked.
=============
@FND and other devs.
what do you think?
-m
[1]
http://en.wikipedia.org/wiki/Internet_media_type#Type_x
[2]
http://fnd.tiddlyspace.com/
[3]
https://github.com/tiddlyweb/tiddlywebwikiclient/blob/master/BinaryTiddlersPlugin.js
[4]
https://github.com/tiddlyweb/tiddlywebwikiclient/blob/master/BinaryTiddlersPlugin.js#L31
[5]
https://github.com/pmario/tw.CodeMirrorPlugin/blob/master/plugins/zCodeMirror2Plugin.js#L516
[6]
https://github.com/pmario/tw.CodeMirrorPlugin/blob/master/plugins/zCodeMirror2Plugin.js#L542
[7]
https://github.com/tiddlyweb/tiddlywebwikiclient/blob/master/BinaryTiddlersPlugin.js#L62