codePreviews: file type aliases
This commit is contained in:
parent
8fcbb1315c
commit
34dd8d4464
1 changed files with 24 additions and 1 deletions
|
@ -23,6 +23,27 @@ function unindent(str) {
|
||||||
return str.replace(new RegExp(`^ {${minIndent}}`, "gm"), "");
|
return str.replace(new RegExp(`^ {${minIndent}}`, "gm"), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fileTypeAliases = {
|
||||||
|
astro: "jsx",
|
||||||
|
svelte: "jsx",
|
||||||
|
vue: "jsx",
|
||||||
|
mdx: "md",
|
||||||
|
jsonc: "json",
|
||||||
|
json5: "json",
|
||||||
|
jsonld: "json",
|
||||||
|
"sublime-build": "json",
|
||||||
|
"sublime-settings": "json",
|
||||||
|
"sublime-menu": "json",
|
||||||
|
"sublime-commands": "json",
|
||||||
|
"sublime-project": "json",
|
||||||
|
"sublime-mousemap": "json",
|
||||||
|
"sublime-keymap": "json",
|
||||||
|
"sublime-macro": "json",
|
||||||
|
"sublime-completions": "json",
|
||||||
|
"code-workspace": "json",
|
||||||
|
"code-snippets": "json",
|
||||||
|
};
|
||||||
|
|
||||||
async function processFile(
|
async function processFile(
|
||||||
link,
|
link,
|
||||||
originalLink,
|
originalLink,
|
||||||
|
@ -96,7 +117,9 @@ async function processFile(
|
||||||
|
|
||||||
return `**${fileName}:** ${whichLines}${warning}\n${
|
return `**${fileName}:** ${whichLines}${warning}\n${
|
||||||
spoiler ? "||" : ""
|
spoiler ? "||" : ""
|
||||||
}\`\`\`${fileType}\n${unindent(targetLines)}\n\`\`\`${spoiler ? "||" : ""}`;
|
}\`\`\`${fileTypeAliases[fileType] ?? fileType}\n${unindent(
|
||||||
|
targetLines
|
||||||
|
)}\n\`\`\`${spoiler ? "||" : ""}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
events.add("messageCreate", "codePreviews", async function (msg) {
|
events.add("messageCreate", "codePreviews", async function (msg) {
|
||||||
|
|
Loading…
Reference in a new issue