generate HTML labels and input controls from markdown
npm install marked-formsMarked.js plugin for generating HTML form inputs from markdown.
Generates labels and input controls from markdown links like text ?input?.
> [!NOTE]
> This package depends on marked v4.3
> and will not be updated going forward.
``sh`
npm install marked-formsmarked.use()breaking changes
- As of v3.0.0, this library uses the plugin api.opts.allowSpacesInLinks
- As of v4.0.0, the plugin will only patch the marked link tokenizer to allow spaces in unbracketed links if
is set. The recommended alternative is to use pointy brackets []( (see CommonMark spec).marked()
- As of v5.0.0, since marked v4.x the function is no longer the default export. CommonJS code which does marked = require(marked) should be changed to call marked.marked( instead of marked().
`javascript
var marked = require('marked');
var markedForms = require('marked-forms');
marked.use(markedForms(opts)); // optional opts { allowSpacesInLinks: true }
var html = marked.marked(markdown);
`
markdown
`md`
[Provide a Name ??]()
html
`html`
- ?? at the start or end of the link text results in an with a
- id and for and name attributes are derived from the text.
- id and for are sluglified, name is not.
- explicit id, for, name can be specified by doing
`html`
- if you don't need need any label, just do ??
`html`
markdown
`md`
Choose one ?select?
- option 1 "val1"
- option 2 "val2"
- option 3
html
`html`
markdown
`md`
?checklist?
- check1
- check2
- check3
html
`html`
markdown
`md`
?checklist?M
- check1
- check2
- check3
html
`html`
markdown
`md`
?radiolist?
- radio 1 "value1"
- radio 2 "value2"
- radio 3 "value3"
html
`html`
markdown
`md`
?radiolist?M
- radio 1 "value1"
- radio 2 "value2"
- radio 3 "value3"
html
`html`
markdown
`md`
Label Text ??*
html
`html`
markdown
`md`
Label Text ??H
html
`html`
markdown
html
`html``
For more details check out the tests.