From d7259d477804a920e0d228eed2bd1bceb3bc4039 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 10 May 2018 19:27:15 +0200 Subject: Add a default configuration --- index.js | 26 ++++++++++++++++++++------ 1 file 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)'); -- cgit v1.2.3