diff options
author | ache <ache@ache.one> | 2018-04-29 10:33:49 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2018-04-29 10:33:49 +0200 |
commit | 1a5c4bd83069de17e1c689f0aff95733ffbd572d (patch) | |
tree | 34f4231e1d610cbdca5df34926a005a204e800ee | |
parent | Merge branch 'master' of srv:git/remark-text-input (diff) |
Fix bugs and tests
-rw-r--r-- | app.js | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,6 +1,6 @@ 'use strict'; -const START = /^(\[_+)/g; +const START = /^(\[_+\n)/g; const END = /(_+])/g; const parseAttr = require('md-attr-parser'); @@ -30,13 +30,17 @@ function plugin() { eaten = res.eaten; prop = res.prop; } + let end = value.search(END); + if (end !== value.match(START)[0].length) { + end -= 1; + } const t = eat(value.slice(0, value.match(END)[0].lenght) + eaten)({ type: 'textarea', data: { hName: 'TEXTAREA', hProperties: prop, hChildren: [{type: 'text', - value: value.slice(value.match(START)[0].length, value.search(END)), + value: value.slice(value.match(START)[0].length, end), }], }, }); |