strip comments

closes #2
This commit is contained in:
Ell 2023-09-08 16:56:19 +02:00
parent 833d0b182a
commit 579b5b17b5
3 changed files with 18 additions and 9 deletions

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,6 +28,13 @@ $.ajax({
cool!!
%%
ANOTHER BLOCK COMMENT
you know
WITH A LOT OF TEXT
%%
blah blah i added and removed this
The following is $x^2 = 7$, but more complicated!