tl;dr A few years ago, i created some extensions for markdown - specifically for collecting user input. Scroll to the bottom for an example of creating a form.
markdown has been great for rendering read-only content over the years, i found it useful to be able to create forms using my extensions (i’m calling it marksup), and many folks with no programming experience seem to agree.
on my github repo I have a grammar, via a lex/yac implementation and a makefile to run my demo.
here is a preview of
creating a input field, a password field, a textarea, a submit button (implemented)
a radio button, a checkboxes ( not implemented )
Choose an Email ?
_____
Choose a password
******
Describe why you want to register
____
_____
Gender
male/female
Which of these features will you need?
[+] simplicity
[-] Don't know
[-] complete
[ok]
This should generate the following HTML when compiled ( make test )
<input type="text" name="Choose an Email ?"/>
<BR>
Choose a password
<input type="password" name="Choose a password"/>
<BR>
Describe why you want to register
<textarea name="Describe why you want to register"><textarea>
<BR>
<input type="button" value="ok" />
i may not be the best person to take this up or come up with specs, but think this may be the best place to talk about it. i also think this is a simple but worthwhile attempt.
Generic Directive Style Brainstorming. The idea is that you could potentially print this as it is and fill it out if you really needed to.
A field starts with a field description of this form, which is always ended by a :
<field description. Field name autodetected in here> :
After the field description, the fieldtype is indicated via examples shown below.
Each field name is either autodetected, or can be pointed via *fieldname* or {fieldname}
!form: Form Header Name
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Choose an *email*?: ______________
Choose a *password*: ***___________
Describe why you want to register:
[________________________________]
[________________________________]{description}
*Gender*: [ "male" / "female" ]
Which of these *features* will you need?:
* [X] simplicity
* [ ] Don't know
* [ ] complete
Radio Button. Which *pet* do you want most?:
* (X) cat
* ( ) dog
* ( ) bird
[>> OK <<] [!! RESET !!]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{action="MAILTO:someone@example.com" method="post" enctype="text/plain"}
Designed to fail gracefully
Choose an email?: ______________
Choose a password: ***___________
[Provide a Name ??]()
[Choose one ?select?](nme)
- option1
- option2
- option3
[?checklist?](name)
- check1
- check2
- check3
[Radiolist with a label before ?radiolist?](name)'
- radio1
- radio2
- radio3
[Submit text ?submit?]()
Hi _________(Name)
How are you doing today? () Good () Ok () Bad
Could I have your email address? __________@(Email)
Write a few lines that describe your mood: ____________///(Mood)
[ Submit your feelings ]
Forms are commonly reused, and often intricate, so I wouldn’t support an inline form composition syntax like that described above. I think that breaks down beyond a trivial form.
But certainly forms are an essential web feature, so I’d suggest enabling them as embedded objects, e.g. ?[label](form_ref). Of course this requires the renderer to load a form definition, and how that’s done is outside the scope of CommonMark.