File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/routes/[pid=pid]/[org]/[repo]/[id=number] Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 3232 import rehypeShikiFromHighlighter from " @shikijs/rehype/core" ;
3333 import { transformerNotationDiff } from " @shikijs/transformers" ;
3434 import posthog from " posthog-js" ;
35+ import type { SpecialLanguage } from " shiki" ;
3536 import type { Plugin } from " svelte-exmarkdown" ;
3637 import type {
3738 DiscussionDetails ,
101102 };
102103
103104 // Utils
104- function detectLanguage(code : string ): string | undefined {
105+ function detectLanguage(code : string ): ( SpecialLanguage | ( string & {})) | undefined {
105106 const hasHTML = / <\/ [a-zA-Z0-9 -] + >/ .test (code );
106107 const hasJS = / (let| var| const| =) / .test (code );
107108
108109 if (hasHTML && hasJS ) return " svelte" ;
109110 if (hasHTML ) return " html" ;
110111 if (hasJS ) return / (: [A-Z ] | type | interface )/ .test (code ) ? " ts" : " js" ;
111112 if (/ [a-z -] + : \S + / .test (code )) return " css" ;
112- return undefined ;
113113 }
114114
115115 function formatToDateTime(date : string ) {
You can’t perform that action at this time.
0 commit comments