aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md61
1 files changed, 61 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e632f9f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,61 @@
+
+mardown-attribute-parser
+===========
+
+A node plugin to parse pandoc-style attributes (custom HTML attributes).
+
+
+## Syntax
+
+The syntax is the same as pandoc's.
+
+```markdown
+{#thisIsAnId .thisIsAClass thisKey=thisValue}
+
+{thatKey="value" thisKey='thatValue'}
+```
+
+## Usage
+
+```js
+const parseAttr = require('markdown-attribute-parser');
+
+
+parseAttr('{ widgth=500px editable=true }');
+
+parseAttr('height=500px');
+```
+
+The output is an object of the form :
+```js
+{
+ prop: { // Keep the key-value attribute
+ class: undefined, // A list of class
+ id: undefined, // The uniq id
+ },
+ eaten: '', // Every characters parsed
+}
+```
+
+For example this code will output :
+```js
+parseAttr('{ widgth=500px editable=true #unicorn .dangerous .cute }');
+```
+
+```js
+{
+ prop: {
+ class: ['dangerous', 'cute'],
+ id: 'unicorn',
+ widgth: '500px',
+ editable: 'true',
+ },
+ eaten: '{ widgth=500px editable=true #unicorn .dangerous .cute }',
+}
+```
+
+
+## Licence
+
+MIT
+