aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-05-10 19:27:15 +0200
committerache <ache@ache.one>2018-05-10 19:56:58 +0200
commitd7259d477804a920e0d228eed2bd1bceb3bc4039 (patch)
tree9c05de207fba822e71b947da7549288efdee8531
parentAdd a configuration option (diff)
Add a default configuration
-rw-r--r--index.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/index.js b/index.js
index cf37de4..8371830 100644
--- a/index.js
+++ b/index.js
@@ -31,6 +31,21 @@ const convTypeTag = {
'link': 'a',
'header': 'h1',
};
+/* TODO :
+ * - [ ] fencedCode // require('./tokenize/code-fenced'),
+ - [ ] atxHeading //require('./tokenize/heading-atx'),
+ - [ ] setextHeading //require('./tokenize/heading-setext'),
+ - [ ] table //require('./tokenize/table'),
+ - [x] link //require('./tokenize/link'),
+ - [ ] strong //require('./tokenize/strong'),
+ - [ ] emphasis //require('./tokenize/emphasis'),
+ - [ ] deletion //require('./tokenize/delete'),
+ - [ ] code //require('./tokenize/code-inline'),
+ - [ ] break //require('./tokenize/break'),
+
+ Tests with ava
+ xo as linter
+*/
function filterAttributes( prop, config, type ) {
const scope = config.scope;
@@ -63,17 +78,16 @@ function filterAttributes( prop, config, type ) {
return prop;
}
-module.exports = function linkAttr( config ) {
+module.exports = function linkAttr( config_user ) {
let parser = this.Parser;
- if( config === undefined ) {
- config = {
+ const defaul_config = {
allowDangerousDOMEventHandlers: false,
- elements: ["links","images","headers"],
+ elements: ["link","image","header"],
extends: [],
scope: "specific",
- };
- }
+ };
+ const config = {...defaul_config, ...config_user};
if (!isRemarkParser(parser)) {
throw new Error('Missing parser to attach `remark-attr` [link] (to)');