@@ -59,7 +59,9 @@ require('posthtml-url-parameters')({
59
59
60
60
Default: ` [a] `
61
61
62
- Array of tag names to process. Only URLs inside ` href="" ` attributes of tags in this array will be processed.
62
+ Array of tag names to process.
63
+
64
+ By default, only URLs inside ` href="" ` attributes of tags in this array will be processed.
63
65
64
66
Example:
65
67
@@ -70,13 +72,48 @@ require('posthtml-url-parameters')({
70
72
})
71
73
```
72
74
75
+ You may use some CSS selectors when specifying tags:
76
+
77
+ ``` js
78
+ require (' posthtml-url-parameters' )({
79
+ tags: [' a.button' , ' a[href*="example.com"]' ' link' ],
80
+ // ...
81
+ })
82
+ ```
83
+
84
+ All [ ` posthtml-match-helper ` selectors] ( https://github.com/posthtml/posthtml-match-helper ) are supported.
85
+
86
+ ### ` strict `
87
+
88
+ Default: ` false `
89
+
90
+ By default, the plugin will append query parameters only to valid URLs.
91
+
92
+ You may disable ` strict ` mode to append parameters to any string:
93
+
94
+ ``` js
95
+ const posthtml = require (' posthtml' )
96
+ const urlParams = require (' posthtml-url-parameters' )
97
+
98
+ posthtml ([
99
+ urlParams ({
100
+ parameters: { foo: ' bar' },
101
+ strict: false ,
102
+ })
103
+ ])
104
+ .process (' <a href="https://example.com/campaigns/{{ id }}">Details</div>' )
105
+ .then (result => console .log (result .html )))
106
+
107
+ // <a href="https://example.com/campaigns/{{ id }}?foo=bar">Details</div>
108
+ ```
109
+
73
110
### ` qs `
74
111
75
112
Default: ` undefined `
76
113
77
114
Options to pass to ` query-string ` - see available options [ here] ( https://github.com/sindresorhus/query-string#stringifyobject-options ) .
78
115
79
- For example, you can disable encoding:
116
+ For example, you may disable encoding:
80
117
81
118
``` js
82
119
const posthtml = require (' posthtml' )
0 commit comments