Text display is good now

This commit is contained in:
Gnarwhal 2024-09-18 21:47:51 +01:00
parent 3fc1ca3591
commit 0be9d3de31
Signed by: Gnarwhal
GPG key ID: 80DB5B37E4C96776
5 changed files with 84 additions and 34 deletions

View file

@ -60,7 +60,36 @@ export default function Content({ src }: { src: string}) {
return response.text();
},
postprocess: (data: string) => {
set_content(<Text text={data} />);
const languages = {
// "markup",
js: "jsx",
mjs: "jsx",
jsx: "jsx",
// "js-extras",
ts: "tsx",
tsx: "tsx",
swift: "swift",
kt: "kotlin",
kts: "kotlin",
ktm: "kotlin",
// "objectivec",
// "reason",
rs: "rust",
// "graphql",
yml: "yaml",
yaml: "yaml",
go: "go",
c: "cpp",
cpp: "cpp",
cxx: "cpp",
h: "cpp",
hpp: "cpp",
hxx: "cpp",
py: "python",
json: "json",
}
const split = window.location.pathname.split('.');
set_content(<Text language={split.length == 0 ? 'none' : languages[split[split.length - 1]]} text={data} />);
}
};
}