aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-05-18 04:44:26 +0200
committerache <ache@ache.one>2018-05-18 04:44:26 +0200
commit9afd1788992caa72523fa3e84c3a421a843ebc71 (patch)
tree4917e838cde53328af10e26e5a2cea2d338796f6 /README.md
parentAdd tests with ava (diff)
Tests with README
Diffstat (limited to 'README.md')
-rw-r--r--README.md98
1 files changed, 78 insertions, 20 deletions
diff --git a/README.md b/README.md
index 43ad188..02d6994 100644
--- a/README.md
+++ b/README.md
@@ -2,18 +2,13 @@
This plugin add support of custom attributes to Markdown syntax.
-**This is an alpha not ready to be used in production.**
+**This is an alpha not ready to be used in production.** but will be soon.
-For the moment, it only support image and link.
-
-It aimed to support any other elements of the markdown syntax.
-
-Also for security reasons, this plugin should use [html-element-attributes](https://github.com/wooorm/html-element-attributes).
-The use of JavaScript attributes (onload for example) must not be allowed by default.
+Also for security reasons, this plugin use [html-element-attributes](https://github.com/wooorm/html-element-attributes).
+The use of JavaScript attributes (onload for example) is not allowed by default.
## Default Syntax
-
Images :
```markdown
![alt](img){attrs} / ![alt](img){ height=50 }
@@ -24,11 +19,35 @@ Links :
[Hot babe with computer](https://rms.sexy){rel="external"}
```
+Header (Atx) :
+```markdown
+### This is a title
+{style="color:red;"}
+```
+
+Emphasis :
+```markdown
+Npm stand for *node*{style="color:red"} packet manager.
+```
+
+Strong :
+```markdown
+This is a **Unicorn**{awesome} !
+```
+
+Delete :
+```markdown
+Your problem is ~~at line 18~~{style="color: grey"}. My mistake, it's at line 14.
+```
+
+Code :
+```markdown
+You can use the `fprintf`{lang=c} function to format the output to a file.
+```
+
## rehype
-This plugin is compatible with [rehype][rehype].
-Actually, it wouldn't really do much good otherwise.
-At the moment it aims is to be used with remark-rehype only.
+At the moment it aims is to be used with [rehype][rehype] only, using remark-rehype.
```md
[Hot babe with computer](https://rms.sexy){rel="external"}
@@ -36,7 +55,6 @@ At the moment it aims is to be used with remark-rehype only.
gives:
-
```html
<a href="https://rms.sexy" rel="external">Hot babe with computer</a>
```
@@ -91,20 +109,60 @@ $ node index.js
<p><img src="https://ache.one/res/ache.svg" alt="ache avatar" height="100"></p>
```
+This package can be configurated.
+
+```javascript
+unified()
+ .use(remarkParse)
+ .use(remarkAttr, config)
+ .use(remark2rehype)
+ .use(stringify)
+ .process( testFile, (err, file) => {
+ console.log(String(file))
+ } )
+```
+
+Here are the defaults options :
-<!-- Should talk about options -->
+```javascript
+ {
+ allowDangerousDOMEventHandlers: false,
+ elements: ['link', 'image', 'header'],
+ extends: {},
+ scope: 'specific',
+ };
+```
-## License
+**allowDangerousDOMEventHandlers** : A boolean
-<!-- GNUv3 or MIT -->
+Allow the use of `on-*` attributs. They are depreciated and disabled by default for security reason.
-[zds]: https://zestedesavoir.com
+**elements** : A list of elements from this list `[ 'link', 'image', 'header', 'strong', 'emphasis', 'deletion', 'code', 'atxHeader' ]` or `"*"`.
-[npm]: https://www.npmjs.com/package/remark-attr
+List of every tags on witch remark-attr will be activated or `'*'` to activate remark-attr on every supported tags.
-[mdast]: https://github.com/syntax-tree/mdast/blob/master/readme.md
+**extends** : An object that extends the list of attributs supported for some elements.
-[rehype]: https://github.com/wooorm/rehype
+Example :
+```
+{extends: {image: ['original', 'quality', 'format', 'exposition']}}
+```
+
+With this configuration, if the scope permit it, 4 mores attributs will be supported for image elements.
-[parent]: https://github.com/syntax-tree/unist#parent
+**scope** : 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.
+
+## License
+
+<!-- MIT -->
+
+[npm]: https://www.npmjs.com/package/remark-attr
+
+[rehype]: https://github.com/wooorm/rehype