aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-05-19 01:15:53 +0200
committerache <ache@ache.one>2018-05-19 01:26:22 +0200
commit8a7f415b516ed12ec13dce27abeac6482a1d8ca1 (patch)
tree0ddefce8d4fb1c4be6b962f01d112eff046af402 /README.md
parentSupport non atx header (diff)
Configuration specification in the README
Diffstat (limited to 'README.md')
-rw-r--r--README.md70
1 files changed, 32 insertions, 38 deletions
diff --git a/README.md b/README.md
index 02d6994..2ac14ca 100644
--- a/README.md
+++ b/README.md
@@ -67,9 +67,7 @@ gives:
npm install remark-attr
```
-## Usage
-
-### Dependencies:
+## Dependencies:
```javascript
const unified = require('unified')
@@ -80,7 +78,7 @@ const remarkAttr = require('remark-attr')
```
-### Usage:
+## Usage:
```javascript
const testFile = `
@@ -109,58 +107,54 @@ $ node index.js
<p><img src="https://ache.one/res/ache.svg" alt="ache avatar" height="100"></p>
```
-This package can be configurated.
+## API
-```javascript
-unified()
- .use(remarkParse)
- .use(remarkAttr, config)
- .use(remark2rehype)
- .use(stringify)
- .process( testFile, (err, file) => {
- console.log(String(file))
- } )
-```
+### `remarkAttr([options])`
-Here are the defaults options :
+Parse attributes of markdown elements.
-```javascript
- {
- allowDangerousDOMEventHandlers: false,
- elements: ['link', 'image', 'header'],
- extends: {},
- scope: 'specific',
- };
-```
+#### `remarkAttr.SUPPORTED_ELEMENTS`
+
+The list of currently supported elements.
+
+`['link', 'atxHeading', 'strong', 'emphasis', 'deletion', 'code', 'setextHeading']`
-**allowDangerousDOMEventHandlers** : A boolean
+##### Options
-Allow the use of `on-*` attributs. They are depreciated and disabled by default for security reason.
+###### `options.allowDangerousDOMEventHandlers`
-**elements** : A list of elements from this list `[ 'link', 'image', 'header', 'strong', 'emphasis', 'deletion', 'code', 'atxHeader' ]` or `"*"`.
+Whether to allow the use of `on-*` attributs. They are depreciated and disabled by default for security reason. Its a boolean (default: `false`).
+If allowed, DOM event handlers will be added to the global scope.
-List of every tags on witch remark-attr will be activated or `'*'` to activate remark-attr on every supported tags.
+###### `options.elements`
-**extends** : An object that extends the list of attributs supported for some elements.
+The list of elements witch the attributes should be parsed. It's a list of string, a sublist of `SUPPORTED_ELEMENTS`.
+
+###### `options.extend`
+
+An object that extends the list of attributs supported for some elements.
Example :
+
```
-{extends: {image: ['original', 'quality', 'format', 'exposition']}}
+extend: {atxHeading: ['original', 'quality', 'format', 'toc']}
```
-With this configuration, if the scope permit it, 4 mores attributs will be supported for image elements.
+With this configuration, if the scope permit it, 4 mores attributs will be supported for atxHeading elements.
+
+###### `options.scope`
-**scope** : A string with the value `"global"` or `"specific"` or `"extented"` or `"none"` or `"every"`.
+A string with the value `"global"` or `"specific"` or `"extented"` or `"none"` or `"every"`.
-`"none"` will disable the plugin
-`"global"` will activate only the global attributs
-`"specific"` will activate global and specific attributs.
-`"extented"` will add personalized tags for some elements.
-`"permissive"` or `"every"` will allow every attributs (execpt dangerous one) on every elements supported.
+ - `"none"` will disable the plugin.
+ - `"global"` will activate only the global attributs.
+ - `"specific"` will activate global and specific attributs.
+ - `"extented"` will add personalized tags for some elements.
+ - `"permissive"` or `"every"` will allow every attributs (execept dangerous one) on every elements supported.
## License
-<!-- MIT -->
+Distributed under a MIT-like license.
[npm]: https://www.npmjs.com/package/remark-attr