mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-24 06:32:08 -05:00
parent
3d73834bef
commit
4719150368
6 changed files with 122 additions and 3 deletions
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
@ -0,0 +1 @@
|
|||
src/components/markdown/prism.ts
|
|
@ -133,6 +133,7 @@
|
|||
"typescript": "^4.4.2",
|
||||
"ulid": "^2.3.0",
|
||||
"use-resize-observer": "^7.0.0",
|
||||
"vite-plugin-compression": "^0.3.6",
|
||||
"vite-plugin-pwa": "^0.8.1",
|
||||
"workbox-precaching": "^6.1.5"
|
||||
},
|
||||
|
|
|
@ -9,8 +9,6 @@ import MarkdownEmoji from "markdown-it-emoji/dist/markdown-it-emoji-bare";
|
|||
import MarkdownSub from "markdown-it-sub";
|
||||
// @ts-expect-error No typings.
|
||||
import MarkdownSup from "markdown-it-sup";
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/themes/prism-tomorrow.css";
|
||||
import { RE_MENTIONS } from "revolt.js";
|
||||
|
||||
import styles from "./Markdown.module.scss";
|
||||
|
@ -26,6 +24,7 @@ import { generateEmoji } from "../common/Emoji";
|
|||
|
||||
import { emojiDictionary } from "../../assets/emojis";
|
||||
import { MarkdownProps } from "./Markdown";
|
||||
import Prism from "./prism";
|
||||
|
||||
// TODO: global.d.ts file for defining globals
|
||||
declare global {
|
||||
|
|
104
src/components/markdown/prism.ts
Normal file
104
src/components/markdown/prism.ts
Normal file
|
@ -0,0 +1,104 @@
|
|||
// This file handles importing Prism code highlighting library.
|
||||
|
||||
import Prism from "prismjs";
|
||||
|
||||
// Default: markup, html, xml, svg, mathml, ssml, atom,
|
||||
// rss, css, clike, javascript, js
|
||||
|
||||
import "prismjs/components/prism-c.min.js";
|
||||
import "prismjs/components/prism-cpp.min.js";
|
||||
import "prismjs/components/prism-csharp";
|
||||
import "prismjs/components/prism-bash.min.js";
|
||||
import "prismjs/components/prism-json.min.js";
|
||||
import "prismjs/components/prism-json5.min.js";
|
||||
import "prismjs/components/prism-typescript";
|
||||
import "prismjs/components/prism-rust";
|
||||
import "prismjs/components/prism-markdown";
|
||||
import "prismjs/components/prism-brainfuck";
|
||||
import "prismjs/components/prism-diff";
|
||||
import "prismjs/components/prism-ruby";
|
||||
import "prismjs/components/prism-go";
|
||||
import "prismjs/components/prism-ini";
|
||||
import "prismjs/components/prism-toml";
|
||||
import "prismjs/components/prism-java";
|
||||
import "prismjs/components/prism-kotlin";
|
||||
import "prismjs/components/prism-less";
|
||||
import "prismjs/components/prism-scss";
|
||||
import "prismjs/components/prism-sass";
|
||||
import "prismjs/components/prism-lua";
|
||||
import "prismjs/components/prism-makefile";
|
||||
import "prismjs/components/prism-perl";
|
||||
import "prismjs/components/prism-objectivec";
|
||||
import "prismjs/components/prism-python";
|
||||
import "prismjs/components/prism-r";
|
||||
import "prismjs/components/prism-sql";
|
||||
import "prismjs/components/prism-graphql";
|
||||
import "prismjs/components/prism-shell-session";
|
||||
import "prismjs/components/prism-java";
|
||||
import "prismjs/components/prism-powershell";
|
||||
import "prismjs/components/prism-swift";
|
||||
import "prismjs/components/prism-yaml";
|
||||
import "prismjs/components/prism-visual-basic";
|
||||
import "prismjs/components/prism-asm6502";
|
||||
import "prismjs/components/prism-nasm";
|
||||
import "prismjs/components/prism-wasm";
|
||||
import "prismjs/components/prism-llvm";
|
||||
import "prismjs/components/prism-apacheconf";
|
||||
import "prismjs/components/prism-dns-zone-file";
|
||||
import "prismjs/components/prism-docker";
|
||||
import "prismjs/components/prism-nginx";
|
||||
import "prismjs/components/prism-coq";
|
||||
import "prismjs/components/prism-elixir";
|
||||
import "prismjs/components/prism-elm";
|
||||
import "prismjs/components/prism-erlang";
|
||||
import "prismjs/components/prism-fsharp";
|
||||
import "prismjs/components/prism-haskell";
|
||||
import "prismjs/components/prism-ocaml";
|
||||
import "prismjs/components/prism-reason";
|
||||
import "prismjs/components/prism-scala";
|
||||
import "prismjs/components/prism-sml";
|
||||
import "prismjs/components/prism-xquery";
|
||||
import "prismjs/components/prism-glsl";
|
||||
import "prismjs/components/prism-mel";
|
||||
import "prismjs/components/prism-processing";
|
||||
import "prismjs/components/prism-clojure";
|
||||
import "prismjs/components/prism-lisp";
|
||||
import "prismjs/components/prism-scheme";
|
||||
import "prismjs/components/prism-asciidoc";
|
||||
import "prismjs/components/prism-latex";
|
||||
import "prismjs/components/prism-http";
|
||||
import "prismjs/components/prism-protobuf";
|
||||
import "prismjs/components/prism-fortran";
|
||||
import "prismjs/components/prism-wolfram";
|
||||
import "prismjs/components/prism-matlab";
|
||||
import "prismjs/components/prism-mizar";
|
||||
import "prismjs/components/prism-stan";
|
||||
import "prismjs/components/prism-jsstacktrace";
|
||||
import "prismjs/components/prism-javastacktrace";
|
||||
import "prismjs/components/prism-actionscript";
|
||||
import "prismjs/components/prism-applescript";
|
||||
import "prismjs/components/prism-autohotkey";
|
||||
import "prismjs/components/prism-autoit";
|
||||
import "prismjs/components/prism-coffeescript";
|
||||
import "prismjs/components/prism-dart";
|
||||
import "prismjs/components/prism-gml";
|
||||
import "prismjs/components/prism-livescript";
|
||||
import "prismjs/components/prism-moonscript";
|
||||
import "prismjs/components/prism-qml";
|
||||
import "prismjs/components/prism-vim";
|
||||
import "prismjs/components/prism-nim";
|
||||
import "prismjs/components/prism-swift";
|
||||
import "prismjs/components/prism-haml";
|
||||
import "prismjs/components/prism-ada";
|
||||
import "prismjs/components/prism-arduino";
|
||||
import "prismjs/components/prism-basic";
|
||||
import "prismjs/components/prism-crystal";
|
||||
import "prismjs/components/prism-batch";
|
||||
import "prismjs/components/prism-excel-formula";
|
||||
import "prismjs/components/prism-ebnf";
|
||||
import "prismjs/components/prism-haxe";
|
||||
import "prismjs/components/prism-mongodb";
|
||||
|
||||
import "prismjs/themes/prism-tomorrow.css";
|
||||
|
||||
export default Prism;
|
|
@ -2,6 +2,7 @@ import replace from "@rollup/plugin-replace";
|
|||
import { readFileSync } from "fs";
|
||||
import { resolve } from "path";
|
||||
import { defineConfig } from "vite";
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
import preact from "@preact/preset-vite";
|
||||
|
@ -42,6 +43,10 @@ function getVersion() {
|
|||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
viteCompression({
|
||||
verbose: true,
|
||||
algorithm: "brotliCompress",
|
||||
}),
|
||||
preact(),
|
||||
VitePWA({
|
||||
srcDir: "src",
|
||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -1877,7 +1877,7 @@ chalk@^2.0.0:
|
|||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
chalk@^4.0.0:
|
||||
chalk@^4.0.0, chalk@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
||||
|
@ -4317,6 +4317,15 @@ value-equal@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
|
||||
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
|
||||
|
||||
vite-plugin-compression@^0.3.6:
|
||||
version "0.3.6"
|
||||
resolved "https://registry.yarnpkg.com/vite-plugin-compression/-/vite-plugin-compression-0.3.6.tgz#85e3ce5047ae6747bc3952177177a852fac901be"
|
||||
integrity sha512-aSskQCJsP3VQ8PsnY+vO7UfD5qoFMOEuzg0PG2E9Zqyx+ARmc3wr9KCgOFraZOFW1Y4UAa5BR0SMTjoxHRMJoQ==
|
||||
dependencies:
|
||||
chalk "^4.1.2"
|
||||
debug "^4.3.2"
|
||||
fs-extra "^10.0.0"
|
||||
|
||||
vite-plugin-pwa@^0.8.1:
|
||||
version "0.8.2"
|
||||
resolved "https://registry.yarnpkg.com/vite-plugin-pwa/-/vite-plugin-pwa-0.8.2.tgz#2789a157e2f71faf834d968945efc22eee9ad64a"
|
||||
|
|
Loading…
Reference in a new issue