Html – Wiki or Markdown-like syntax for simple forms

formshtmlmarkdownwiki

Is there any simple language similar to Markdown or one of the Wiki Markups that gets converted into HTML form elements?

For example:

name* = ___________
sex = (x) Male () Female
phones = [] Android [x] iPhone [] Blackberry
city = {BOS, (SFO), NYC}

Would get converted to:

<label>Name (required):</label><input type="text" name="name" id="name"/>
<label>Sex:</label><input type="radio" name="sex" value="Male" checked="checked"/> <input type="radio" name="sex" value="Female"/>
<label>Phones:</label><input type="check" name="phones" value="Android"/> <input type="check" name="phones" value="iPhone" checked="checked"/> <input type="check" name="phones" value="Blackberry"/>
<label>City:</label> 
<select name="city">
  <option value="BOS">BOS</option>
  <option value="SFO" selected="selected">SFO</option>
  <option value="NYC">NYC</option>
</select>

It would be simple to create one myself, but if any existing library/language supports it already, it would save me some time in implementation, documentation and maintenance. It would be preferable if the library worked either in Java (so we could run it server-side) or JavaScript (so we could run it client-side).

Update: I created a github project for this and maleldil implemented it. Feel free to try it out!

Best Answer

I have not been able to find a library that suits my needs, so I forked the WMD project (which SO uses for its Markdown syntax highlighting) and put the project on on Github. I didn't have time to implement it, but maleldil kindly did it himself, so try it out!

Related Topic