aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-04-29 10:33:49 +0200
committerache <ache@ache.one>2018-04-29 10:33:49 +0200
commit1a5c4bd83069de17e1c689f0aff95733ffbd572d (patch)
tree34f4231e1d610cbdca5df34926a005a204e800ee
parentMerge branch 'master' of srv:git/remark-text-input (diff)
Fix bugs and tests
-rw-r--r--app.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app.js b/app.js
index 8e98dc2..fdf3d23 100644
--- a/app.js
+++ b/app.js
@@ -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),
}],
},
});