mirror of
https://github.com/Ellpeck/ObsidianJustSharePlease.git
synced 2024-11-23 10:58:36 +01:00
67 lines
3.1 KiB
HTML
67 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Just Share Please</title>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.5/dist/purify.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/highlight.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/marked@7.0.2/lib/marked.umd.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/marked-katex-extension@3.0.3/lib/index.umd.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/marked-highlight@2.0.4/lib/index.umd.js"></script>
|
|
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter&display=swap">
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=JetBrains+Mono&display=swap">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github-dark.min.css" media="(prefers-color-scheme:dark)">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github.min.css" media="(prefers-color-scheme:light),(prefers-color-scheme:no-preference)">
|
|
<link rel="stylesheet" href="style.css">
|
|
<link rel="icon" href="favicon.ico">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content">
|
|
<div id="main">
|
|
<script>
|
|
let main = $("#main");
|
|
|
|
// TODO display nice message when there is no hash
|
|
|
|
$(window).on("hashchange", display);
|
|
display();
|
|
|
|
function display() {
|
|
let hash = window.location.hash;
|
|
if (hash.startsWith("#"))
|
|
hash = hash.substring(1);
|
|
$.ajax({
|
|
method: "get",
|
|
url: `share.php?id=${hash}`,
|
|
success: t => {
|
|
marked.use(markedKatex());
|
|
marked.use(markedHighlight.markedHighlight({
|
|
langPrefix: "hljs language-",
|
|
highlight: (c, l) => {
|
|
const language = hljs.getLanguage(l) ? l : "plaintext";
|
|
return hljs.highlight(c, {language}).value;
|
|
}
|
|
}));
|
|
main.html(DOMPurify.sanitize(marked.parse(t)));
|
|
},
|
|
// TODO display this error more nicely
|
|
error: (r, s, e) => main.html(e)
|
|
});
|
|
}
|
|
</script>
|
|
</div>
|
|
<div id="footer">
|
|
Created using <a href="https://github.com/Ellpeck/ObsidianJustSharePlease">Just Share Please</a> for <a href="https://obsidian.md">Obsidian</a>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|