This folder contains the "source code" for Auto Comments. Right now, the compiled files are intented to be used by the AutoReviewComments userscript.
In the future, we will migrate to a newer userscript. See #8
There's two popular formats for human-editable data files - JSON and YAML. YAML attempts to be more readable (by humans) than JSON. YAML has less quotations and is indented. However, YAML introduces a signifigant number of overcomplexities that make it hard to work with, and that part about it being "indented" most of the time becomes quite the struggle.
JSON5 is essentually a slighly easier-to-use JSON format that we're trying out. This is an experiment.
In a nutshell, you don't need quotes for "keys", and you can add comments. Otherwise, it's exactly like JSON.
First, the name of the file can really be whatever you want, as long as the extension is ".json5". By convention, we use the domain (+subdomain if it's important) of the site you want these comments to be applicable for.
The file needs to be an array of objects. Each object needs to have the following properties:
| Name | Type | Description |
|---|---|---|
| type | string | One of the following values (as seen in generate-comment-files.js): question, answer, close reason, custom edit rejection, edit summary question |
| title | string | A short summary of this comment. This is only shown to the UserScript user. This might support markdown but try to avoid it. |
| body | string | The actual canned comment. Use markdown syntax and other placeholders as described by the Userscript documentation. |
An example:
// the syntax highlighting here might not be correct, as your markdown viewer might be
// assuming this is JSON instead of JSON5.
[
{
type: "question",
title: "A sample question comment",
body: "Hello [username]! This is a **bold** comment!
}
]The final jsonp files are generated by the generate-comment-files.js script, which is ran by the build-comments npm script. You can run this individually with
npm run build-commentsThis script is also part of the "build everything" script, which will compile the HTML files and everything else.
npm run buildAll the files will end up in the /dist/comments folder.