mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: paste creation; paste viewing; more langs supported; jwt settings class; paste settings class; data validation on paste metadata modification
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
export const displayNames: Record<string, string> = {
|
||||
plaintext: 'Plain Text',
|
||||
abap: 'ABAP',
|
||||
'actionscript-3': 'ActionScript 3',
|
||||
apl: 'APL',
|
||||
applescript: 'AppleScript',
|
||||
ara: 'ARA',
|
||||
awk: 'AWK',
|
||||
bibtex: 'BibTeX',
|
||||
cmake: 'CMake',
|
||||
cobol: 'COBOL',
|
||||
codeql: 'CodeQL',
|
||||
coffee: 'CoffeeScript',
|
||||
cpp: 'C++',
|
||||
csharp: 'C#',
|
||||
css: 'CSS',
|
||||
cue: 'CUE',
|
||||
'dream-maker': 'Dream Maker',
|
||||
erb: 'ERB',
|
||||
fsharp: 'F#',
|
||||
gdresource: 'Godot Resource',
|
||||
gdscript: 'GDScript',
|
||||
gdshader: 'Godot Shader',
|
||||
'git-commit': 'Git Commit',
|
||||
'git-rebase': 'Git Rebase',
|
||||
glsl: 'GLSL',
|
||||
graphql: 'GraphQL',
|
||||
hcl: 'HCL',
|
||||
hjson: 'HJSON',
|
||||
hlsl: 'HLSL',
|
||||
html: 'HTML',
|
||||
ini: 'INI',
|
||||
javascript: 'JavaScript',
|
||||
json: 'JSON',
|
||||
json5: 'JSON5',
|
||||
jsonc: 'JSONC',
|
||||
jssm: 'JSSM',
|
||||
jsx: 'JSX',
|
||||
latex: 'LaTeX',
|
||||
matlab: 'MATLAB',
|
||||
mdx: 'MDX',
|
||||
'objective-c': 'Objective-C',
|
||||
'objective-cpp': 'Objective-C++',
|
||||
ocaml: 'OCaml',
|
||||
php: 'PHP',
|
||||
plsql: 'PL/SQL',
|
||||
postcss: 'PostCSS',
|
||||
powerquery: 'Power Query',
|
||||
purescript: 'PureScript',
|
||||
riscv: 'RISC-V',
|
||||
rst: 'reStructuredText',
|
||||
sas: 'SAS',
|
||||
scss: 'SCSS',
|
||||
shaderlab: 'ShaderLab',
|
||||
sparql: 'SPARQL',
|
||||
sql: 'SQL',
|
||||
'ssh-config': 'SSH Config',
|
||||
'system-verilog': 'SystemVerilog',
|
||||
tasl: 'TASL',
|
||||
tex: 'TeX',
|
||||
toml: 'TOML',
|
||||
tsx: 'TSX',
|
||||
typescript: 'TypeScript',
|
||||
vb: 'VB',
|
||||
vhdl: 'VHDL',
|
||||
viml: 'VimL',
|
||||
wasm: 'WebAssembly',
|
||||
xml: 'XML',
|
||||
xsl: 'XSL',
|
||||
yaml: 'YAML',
|
||||
zenscript: 'ZenScript'
|
||||
};
|
||||
// only include langs that need special display names
|
||||
// e.g. cpp -> C++ or toml -> TOML, langs like java are automatically capitalized
|
||||
@@ -0,0 +1,23 @@
|
||||
import { createHighlighter } from 'shiki';
|
||||
|
||||
import type { Highlighter } from 'shiki';
|
||||
let highlighterPromise: Promise<Highlighter> | null = null;
|
||||
|
||||
async function loadHighlighter() {
|
||||
const res = await fetch('http://localhost:5050/api/paste/create/options');
|
||||
if (!res.ok) throw new Error('Failed to fetch paste options');
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
return createHighlighter({
|
||||
themes: ['github-dark', 'github-light'],
|
||||
langs: data.syntaxes
|
||||
});
|
||||
}
|
||||
|
||||
export function getShiki() {
|
||||
if (!highlighterPromise) {
|
||||
highlighterPromise = loadHighlighter();
|
||||
}
|
||||
return highlighterPromise;
|
||||
}
|
||||
Reference in New Issue
Block a user