2023-06-25 18:16:06 +02:00
|
|
|
|
<!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>
|
2023-08-11 20:51:34 +02:00
|
|
|
|
<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>
|
|
|
|
|
|
2023-08-11 21:07:14 +02:00
|
|
|
|
<!-- TODO consider parsing markdown on the server instead? -->
|
2023-08-11 20:51:34 +02:00
|
|
|
|
<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>
|
2023-06-25 18:16:06 +02:00
|
|
|
|
|
|
|
|
|
<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">
|
2023-08-11 20:51:34 +02:00
|
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css">
|
|
|
|
|
<link href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github-dark.min.css" media="(prefers-color-scheme:dark)" rel="stylesheet">
|
|
|
|
|
<link 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)" rel="stylesheet">
|
|
|
|
|
|
|
|
|
|
|
2023-06-25 18:16:06 +02:00
|
|
|
|
<link rel="icon" href="favicon.ico">
|
|
|
|
|
|
2023-08-11 20:51:34 +02:00
|
|
|
|
<!-- TODO consider improving the style or using Obsidian's default style as a basis? -->
|
2023-06-25 18:16:06 +02:00
|
|
|
|
<style>
|
|
|
|
|
html {
|
|
|
|
|
position: relative;
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
font-family: "Inter", sans-serif;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
code {
|
|
|
|
|
font-family: "JetBrains Mono", monospace;
|
2023-08-11 20:51:34 +02:00
|
|
|
|
font-variant-ligatures: none;
|
|
|
|
|
border-radius: 5px;
|
2023-06-25 18:16:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
max-width: 700px;
|
|
|
|
|
margin: 40px auto 80px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#footer {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
height: 40px;
|
|
|
|
|
margin-top: 40px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
color: #d8d8d8;
|
2023-08-11 20:51:34 +02:00
|
|
|
|
background-color: #1e1e1e;
|
2023-06-25 18:16:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<div id="main">
|
|
|
|
|
<script>
|
|
|
|
|
let main = $("#main");
|
|
|
|
|
|
2023-08-11 19:01:10 +02:00
|
|
|
|
// TODO display nice message when there is no hash
|
2023-08-11 20:51:34 +02:00
|
|
|
|
|
2023-06-25 18:16:06 +02:00
|
|
|
|
$(window).on("hashchange", display);
|
|
|
|
|
display();
|
|
|
|
|
|
|
|
|
|
function display() {
|
|
|
|
|
let hash = window.location.hash;
|
|
|
|
|
if (hash.startsWith("#"))
|
|
|
|
|
hash = hash.substring(1);
|
|
|
|
|
$.ajax({
|
2023-08-09 20:13:44 +02:00
|
|
|
|
method: "get",
|
2023-08-10 19:47:55 +02:00
|
|
|
|
url: `share.php?id=${hash}`,
|
2023-06-25 18:16:06 +02:00
|
|
|
|
success: t => {
|
2023-08-11 20:51:34 +02:00
|
|
|
|
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)));
|
2023-06-25 18:16:06 +02:00
|
|
|
|
},
|
|
|
|
|
// 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>
|