You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,57 @@ There is a [known bug in remark-react](https://github.com/mapbox/remark-react/is
46
46
A [PR](https://github.com/mapbox/remark-react/pull/43) is in waiting, do not hesitate to upvote it !
47
47
The [corresponding issue is here](https://github.com/medfreeman/remark-generic-extensions/issues/9).
48
48
49
+
50
+
## Syntax
51
+
52
+
`!Extension[Content](Argument){Properties}`
53
+
54
+
:information_source: The extension syntax is validated through [regexes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp), that you can inspect [here](https://github.com/medfreeman/remark-generic-extensions/blob/master/src/utils/regexes.js) if needed
55
+
56
+
-`Extension` defines the element you want to use
57
+
58
+
It matches the `\w` character class.
59
+
60
+
```
61
+
Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_].
62
+
```
63
+
64
+
-`Content` defines the element content
65
+
66
+
It matches everything but the `]` character.
67
+
68
+
It can be mapped to any hast element property or value, see [placeholders](#placeholders).
69
+
70
+
-`Argument` defines the element argument
71
+
72
+
It matches everything but the `)` character.
73
+
74
+
It can be mapped to any hast element property or value, see [placeholders](#placeholders).
75
+
76
+
-`Properties` defines the element properties
77
+
78
+
They can have leading and / or trailing spaces before / after the opening / closing braces.
79
+
80
+
The different properties are separated by spaces, and so each of them match any character but spaces, except for quoted properties.
81
+
82
+
### Available properties
83
+
84
+
- id: `#my-id`
85
+
86
+
It will be applied to the top-level hast element.
87
+
- class: `.my-class .my-other-class`
88
+
89
+
It will be applied to the top-level hast element.
90
+
- key / value property: `my-prop=my-value`
91
+
92
+
It can be mapped to any hast element property or value, see [placeholders](#placeholders).
93
+
- key / value quoted property: `my-other-prop="my value with spaces"`
94
+
95
+
It can be mapped to any hast element property or value, see [placeholders](#placeholders).
96
+
- lone property: `my-alone-prop`
97
+
98
+
It can be mapped to any hast element property or value, see [placeholders](#placeholders).
0 commit comments