summaryrefslogtreecommitdiff
path: root/extension/react-app/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'extension/react-app/src/util')
-rw-r--r--extension/react-app/src/util/index.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/extension/react-app/src/util/index.ts b/extension/react-app/src/util/index.ts
index fd74044d..5a95be41 100644
--- a/extension/react-app/src/util/index.ts
+++ b/extension/react-app/src/util/index.ts
@@ -46,3 +46,57 @@ export function getFontSize(): number {
const fontSize = localStorage.getItem("fontSize");
return fontSize ? parseInt(fontSize) : 13;
}
+
+export function getMarkdownLanguageTagForFile(filepath: string): string {
+ const ext = filepath.split(".").pop();
+ switch (ext) {
+ case "py":
+ return "python";
+ case "js":
+ return "javascript";
+ case "ts":
+ return "typescript";
+ case "java":
+ return "java";
+ case "go":
+ return "go";
+ case "rb":
+ return "ruby";
+ case "rs":
+ return "rust";
+ case "c":
+ return "c";
+ case "cpp":
+ return "cpp";
+ case "cs":
+ return "csharp";
+ case "php":
+ return "php";
+ case "scala":
+ return "scala";
+ case "swift":
+ return "swift";
+ case "kt":
+ return "kotlin";
+ case "md":
+ return "markdown";
+ case "json":
+ return "json";
+ case "html":
+ return "html";
+ case "css":
+ return "css";
+ case "sh":
+ return "shell";
+ case "yaml":
+ return "yaml";
+ case "toml":
+ return "toml";
+ case "tex":
+ return "latex";
+ case "sql":
+ return "sql";
+ default:
+ return "";
+ }
+}