Files
archtika/web-app/src/lib/utils.ts

30 lines
873 B
TypeScript
Raw Normal View History

import markdownit from "markdown-it";
import hljs from "highlight.js";
import { dev } from "$app/environment";
2024-07-31 07:23:32 +02:00
export const sortOptions = [
{ value: "creation-time", text: "Creation time" },
{ value: "last-modified", text: "Last modified" },
{ value: "title-a-to-z", text: "Title - A to Z" },
{ value: "title-z-to-a", text: "Title - Z to A" }
];
export const ALLOWED_MIME_TYPES = ["image/jpeg", "image/png", "image/svg+xml", "image/webp"];
export const md = markdownit({
linkify: true,
typographer: true,
highlight: (str, lang) => {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(str, { language: lang }).value;
} catch (_) {}
}
return "";
}
});
export const API_BASE_PREFIX = dev ? "http://localhost:3000" : "/api";
export const NGINX_BASE_PREFIX = dev ? "http://localhost:18000" : "/user-websites";