aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: e4c1d7128b5a12d4307731e721f4243307e1c377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# remark-text-input

A [remark](https://github.com/remarkjs/remark/) plugin that parse Mardown syntax to add support for text area.


## Syntax

You can add a text area this way :

```markdown
[______
Some text.
_____]
```

Wich leads to :

![Screenshot](https://raw.githubusercontent.com/arobase-che/remark-text-input/master/images/example_1.png)


## Installation

Easy as npm i :

```shell
npm install remark-text-input
```


## Installation

An example of code :

```js
const unified = require('unified')
const remarkParse = require('remark-parse')
const stringify = require('rehype-stringify')
const remark2rehype = require('remark-rehype')

const textInput = require('remark-text-input')

const testFile = `This is a text area : 

[_____
A editable text here
_____]`

unified()
  .use(remarkParse)
  .use(textInput)
  .use(remark2rehype) 
  .use(stringify)
  .process( testFile, (err, file) => {
    console.log(String(file));
  } );
```

In the file, a text-area should be preceded by an empty line.

## Configuration

This plugin support custom HTML attributes :

```markdown
[____
Here
some
text
_____]{.row=5 .cols=10}
```

## Licence

MIT