Skip to content

Commit ade18b9

Browse files
committed
doc: info on parsing of metadata comments
1 parent 5bde62a commit ade18b9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

content/api/metadata-block.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ The metadata must follow the format:
1515
// @key value
1616
// ==/UserScript==
1717
```
18-
Each line of the block must start with `//`, the first line must be `// ==UserScript==` and the last line must be `// ==/UserScript==`. No extra space is allowed at the beginning or ending of line.
18+
Each line of the block must start with `//`, the first line must be `// ==UserScript==` and the last line must be `// ==/UserScript==`.
19+
20+
Make sure to maintain compatibility with various browsers and extensions that can install userscripts:
21+
22+
1. Don't add extraneous text or spaces at the beginning or ending of the metadata comments.
23+
2. Use exactly one space after `//` in every metadata comment.
24+
3. Put the metadata comment at the very beginning of the file to support engines like ScriptCat.
25+
26+
Violentmonkey 2.12.0 and newer ignores spaces around the metadata comments.
27+
28+
Violentmonkey 2.26.1 and newer ignores any extraneous text around the metadata comments, just like Tampermonkey or Firemonkey, but there'll be an error message about the broken syntax when installing or editing the script.
1929

2030
Some of the keys can be localized for multiple languages, by adding a colon and the locale code to the key, e.g. `@name:zh-CN`. The locale code is case insensitive.
2131

0 commit comments

Comments
 (0)