mirror of
https://github.com/Ellpeck/ObsidianJustSharePlease.git
synced 2024-11-23 19:08:35 +01:00
67 lines
3 KiB
HTML
67 lines
3 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/katex@0.16.8/dist/katex.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/markdown-it@13.0.1/dist/markdown-it.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/markdown-it-texmath/texmath.min.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="not (prefers-color-scheme: dark)">
|
|
<link rel="stylesheet" href="style.css">
|
|
<link rel="icon" href="favicon.ico">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content">
|
|
<div id="main">
|
|
<script>
|
|
let md = markdownit({
|
|
html: true,
|
|
linkify: true,
|
|
langPrefix: "hljs language-",
|
|
highlight: (c, l) => {
|
|
const language = hljs.getLanguage(l) ? l : "plaintext";
|
|
return hljs.highlight(c, {language}).value;
|
|
}
|
|
});
|
|
md.use(texmath, {
|
|
engine: katex,
|
|
delimiters: ["dollars", "beg_end"]
|
|
});
|
|
|
|
let main = $("#main");
|
|
$(window).on("hashchange", display);
|
|
display();
|
|
|
|
function display() {
|
|
let hash = window.location.hash;
|
|
if (hash.startsWith("#"))
|
|
hash = hash.substring(1);
|
|
$.ajax({
|
|
method: "get",
|
|
url: hash ? `share.php?id=${hash}` : "index.md",
|
|
success: t => main.html(DOMPurify.sanitize(md.render(t))),
|
|
error: (r, s, e) => main.html(`<div class="error"><p>Error loading shared note with id <code>${hash}</code>: ${e}</p><p><a href="#">Home</a></p></div>`)
|
|
});
|
|
}
|
|
</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>
|