okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-clean-7 (045843071): the app loads screens, languages, Prism and Time-skip on first use; main chunk 3,123,528 -> 755,418 B, start screen 248.5 -> 143.4 ms (p2006 Chrome, median of 10); nothing users see changes (cleanup step 7)1631a9fde

main
998 B6 linesraw
1/** The language name of a code fence or a file name. Kept apart from the highlighter (syntax.ts, which carries the Prism grammars) so a code block can name its language before the grammars have loaded. */
2const aliases:Record<string,string>={ts:'typescript',tsx:'tsx',mts:'typescript',cts:'typescript',js:'javascript',jsx:'jsx',mjs:'javascript',cjs:'javascript',py:'python',pyw:'python',md:'markdown',mdx:'markdown',markdown:'markdown',html:'markup',htm:'markup',xml:'markup',svg:'markup',json:'json',css:'css',sh:'bash',shell:'bash',bash:'bash',zsh:'bash',yml:'yaml',yaml:'yaml',rs:'rust',go:'go',java:'java',c:'c',h:'c',cc:'cpp',cpp:'cpp',cxx:'cpp',hpp:'cpp',cs:'csharp',csharp:'csharp',sql:'sql',typescript:'typescript',javascript:'javascript',python:'python',rust:'rust'};
3export function codeLanguage(value:string,filename=false){
4 const input=filename?(value.split(/[?#]/)[0].split('.').at(-1)??''):value.trim().split(/\s/)[0].toLowerCase();
5 return aliases[input.toLowerCase()]??'plain';
6}