marked-forms
Custom marked renderer to generate html form inputs.
installation
npm install marked-forms
usage
var marked = require('marked');
var renderer = new marked.Renderer();
require('marked-forms')(renderer); // monkey-patches the renderer
var html = marked(markdown, {renderer:renderer});
text input
markdown
[Provide a Name ??]()
html
<label for="provide-a-name">Provide a Name</label>
<input name="Provide a Name" id="provide-a-name">
??
at the start or end of the link text results in an<input>
with a<label>
before or after it.id
andfor
andname
attributes are derived from the text.id
andfor
are sluglified,name
is not.explicit
id
,for
,name
can be specified by doing
[Different label ??](nme)
<label for="nme">Different label</label>
<input name="nme" id="nme">
- if you don't need need any label, just do
[??](nme)
<input name="nme" id="nme">
select
markdown
[Choose one ?select?](nme)
- option1
- option2
- option3
html
<label for="nme">Choose one</label>
<select name="nme" id="nme">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option value="option3">option3</option>
</select>
check list
markdown
[?checklist?](name)
- check1
- check2
- check3
html
<label class="checkbox">check1<input type="checkbox" name="name" value="check1"></label>
<label class="checkbox">check2<input type="checkbox" name="name" value="check2"></label>
<label class="checkbox">check3<input type="checkbox" name="name" value="check3"></label>
there's more
Additional doc coming soon. For now check out code and tests.