Friday, February 18, 2011

If I Would Design A Simple Format

There is an idea I wanted to spit out for quite a while now. It is about simple formats and to keep the short story short, here is a simple spec I cooked up.

Basically it is a mix of RDoc, Markdown and Maruku, plus some stuff I miss in all of them. The main goal in this one is readability mixed with abilities to handle everyday things, like images, tables, API references and stuff. HTML might be allowed as a fallback.

That's all, let me know what you think about it.


= Head 1
== Head 2
=== Head 3
==== Head 4

# Head 1
## Head 2
### Head 3
#### Head 4

= Head 1 #anchor1
## Head 2 #anchor2


*bold*
~italic~
_underline_
-strike through-
`type text`


http://some.url
</some.url>
<http://some.url>
<Some text:/some.url>

some@email.com
<some@email.com>
<Some email:some@email.com>


API Links

{ClassName#instanceMethod}
{ClassName.classMethod}

Defining a default scope
{-ClassName} after that
{#instanceMethod}
{.classMethod}


<img:/some.url>
<swf:/some.url>

<img:123x234:/some.url>
<swf:123x234:/some.url>

<img:Some title text:/some.url>
<swf:Some title text:/some.url>

<img:Some title text:123x234:/some.url>
<swf:Some title text:123x234:/some.url>


Code formatting


Just a genuine piece of code
That is pre formatted


Ruby piece of code

:ruby
this.is_a?(Ruby)
code.which_we do
paint in some do
nice(colors)
end
end

Javascript code

:javascript
this.isA(JavaScript).code();
that.we(Paint).accordingly();


> This is a quote text
> It will be converted to a block-quote
> > This is and internal quote
> > it will be nested into the original one


* List item 1
* List item 2

- List item 1
- List item 2


1. Num list item 1
2. Num list item 2


a. Letter list item 1
b. Letter list item 2


I. Roman number list item 1
II. Roman number list item 2
III. Roman number list item 3


* Mixed list 1
* Mixed list 2

- Mixed List 3
- Mixed List 4

1. Mixed List 5
2. Mixed List 6

a. Mixed List 7
b. Mixed List 8

I. Mixed List 9
II. Mixed List 10


Head | Head | Head
-----|------|-------------------
Cell | Cell | Cell
Cell | Cell | Cell
-----|------|-------------------
Foot | Foot | Foot


Head | Head | Head
| Head | Head |
-----|------|------|------------
Cell | Cell | Cell | Cell
Cell | Cell | Cell
Cell | Cell | Cell | Cell
| Cell | Cell |
-----|-------------|------------
Foot | Foot | Foot


Right | Left | Center |
----->|<-----------|------x------|
1 | 1 | 1 |
11 | 11 | 111 |
111 | 111 | 11111 |
1111 | 1111 | 1111111 |