0.6.0 • Published 7 years ago
remark-line-input v0.6.0
remark-line-input
A remark plugin that parse markdown syntax to add support for line input.
This plugin is intend to be used with Javascript to create interaction.
Syntax
You can add a line input this way :
[___Placeholder___]Which leads to :

A markdown line input starts by [__ and ends by __].
[___hold my beer___]That syntax is not valid :
[___ Spaces_are_not_allowed ___]
^ ^^
[___Nor line feeds
____]Installation
Easy as npm i
$ npm install remark-line-inputDependencies:
const unified = require('unified')
const remarkParse = require('remark-parse')
const stringify = require('rehype-stringify')
const remark2rehype = require('remark-rehype')
const lineInput = require('remark-line-input')Usage
An example of code :
const testFile = `Login : [__email or username__]{#login}
Passwd: [__Passwd__]{#password type=password}`
unified()
.use(remarkParse)
.use(lineInput)
.use(remark2rehype)
.use(stringify)
.process( testFile, (err, file) => {
console.log(String(file));
} );Configuration
This plugin support custom HTML attributes thought md-attr-parser :
[___Password___]{type=password}

Or :
[___Email___]{.form-elem onchange='check();' #login}Licence
Distributed under a MIT-like license.