Compare commits

...

4 commits

Author SHA1 Message Date
Ell 56184ef7ff 0.1.4 2023-09-08 17:42:18 +02:00
Ell e3cc6b6bc2 improved line height
closes #3
2023-09-08 17:39:19 +02:00
Ell 209f0a1152 added footnote support
closes #1
2023-09-08 17:35:11 +02:00
Ell 579b5b17b5 strip comments
closes #2
2023-09-08 16:56:19 +02:00
7 changed files with 47 additions and 15 deletions

View file

@ -1,7 +1,7 @@
{
"id": "just-share-please",
"name": "Just Share Please",
"version": "0.1.3",
"version": "0.1.4",
"minAppVersion": "1.3.7",
"description": "Quickly and easily share individual notes online using an anonymized link. Also easy to self-host!",
"author": "Ellpeck",

View file

@ -1,6 +1,6 @@
{
"name": "just-share-please",
"version": "0.1.3",
"version": "0.1.4",
"description": "Quickly and easily share individual notes online using an anonymized link. Also easy to self-host!",
"main": "main.js",
"scripts": {

View file

@ -14,6 +14,7 @@
<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@1.0.0/texmath.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/markdown-it-anchor@8.6.7/dist/markdownItAnchor.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/markdown-it-footnote@3.0.3/dist/markdown-it-footnote.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">
@ -46,9 +47,25 @@
placement: "after",
ariaHidden: true
}),
// prepend current file id to the anchor permalink (see getId)
// prepend current file id to the anchor permalink
slugify: s => `${getId() ?? ""}-${encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, "-").replace(/[^A-Za-z0-9_-]/g, ""))}`
});
md.use(markdownitFootnote);
let rulesToReplace = [
// prepend current file id to footnotes
["footnote_ref", [/href="#(fn\d+)"/, `href="#${getId() ?? ""}-$1"`]],
["footnote_open", [/id="(fn\d+)"/, `id="${getId() ?? ""}-$1"`]],
// prepend current file id to footnote refs
["footnote_ref", [/id="(fnref\d+)"/, `id="${getId() ?? ""}-$1"`]],
["footnote_anchor", [/href="#(fnref\d+)"/, `href="#${getId() ?? ""}-$1"`]]
];
for (let replacement of rulesToReplace) {
let prevRule = md.renderer.rules[replacement[0]];
md.renderer.rules[replacement[0]] = (tokens, idx, options, env, self) => {
return prevRule(tokens, idx, options, env, self).replace(...replacement[1]);
};
}
let main = $("#main");
$(window).on("hashchange", display);

View file

@ -12,6 +12,7 @@ code {
font-family: "JetBrains Mono", monospace;
font-variant-ligatures: none;
border-radius: 5px;
line-height: initial;
}
img {
@ -53,6 +54,7 @@ h1:hover .header-anchor, h2:hover .header-anchor, h3:hover .header-anchor, h4:ho
.content {
max-width: 700px;
margin: 40px auto 80px;
line-height: 1.5;
}
.error {

View file

@ -230,6 +230,9 @@ export default class JustSharePleasePlugin extends Plugin {
if (this.settings.stripFrontmatter)
text = text.replace(/^---\s*\n.*?\n---\s*\n(.*)$/s, "$1");
// strip comments
text = text.replace(/%%.*?%%/sg, "");
// include note name
if (this.settings.includeNoteName)
text = `# ${file.basename}\n\n${text}`;

View file

@ -2,18 +2,13 @@
"url": "http://localhost:8080",
"shared": [
{
"id": "234df7b7",
"password": "0ef1504bfe83cd9ca812434caa7aacf4",
"id": "22478da6",
"password": "5553101a4b7cb2b47dab2bb15ba6cd51",
"path": "Cool Test Note.md"
},
{
"id": "014b266c",
"password": "1c9459d7cdac804f72272c8f6d4a9abc",
"path": "dir/Cool Test Note.md"
}
],
"stripFrontmatter": true,
"includeNoteName": true,
"unshareDeletedFiles": false,
"autoUpdateShares": false
}
}

View file

@ -2,7 +2,11 @@
test: yes
---
This is a cool test note, my friends!
This is a cool test note%%with an inline comment%%, my friends!
%%
BLOCK COMMENT
%%
> How are you?
@ -24,9 +28,16 @@ $.ajax({
cool!!
blah blah i added and removed this
%%
ANOTHER BLOCK COMMENT
you know
The following is $x^2 = 7$, but more complicated!
WITH A LOT OF TEXT
%%
blah blah i added and[^text] removed this[^1]
The following is $x^2 = 7$, but more^[Inline footnote!] complicated!
$$
x^2 + \sum_{i = 1}^{10000} x^2 \cdot 0 = 7
$$
@ -41,4 +52,8 @@ wikilink image!
![[Pasted image 20230816130420.png]]
nice
nice
[^1]: Normal footnote!
[^text]: Text footnote