mirror of
https://github.com/Ellpeck/ObsidianJustSharePlease.git
synced 2024-11-26 20:28:34 +01:00
added the ability to include the note title in the note
This commit is contained in:
parent
0fa6dff2d6
commit
0679f3add8
5 changed files with 23 additions and 16 deletions
|
@ -204,6 +204,11 @@ export default class JustSharePleasePlugin extends Plugin {
|
|||
if (this.settings.stripFrontmatter)
|
||||
text = text.replace(/^---\s*\n.*?\n---\s*\n(.*)$/s, "$1");
|
||||
|
||||
// include note name
|
||||
if (this.settings.includeNoteName) {
|
||||
text = `# ${file.basename}\n\n${text}`;
|
||||
}
|
||||
|
||||
// embed attachments directly
|
||||
let attachments = /!\[(.*)]\((.+)\)|!\[\[(.+)]]/g;
|
||||
let match: RegExpExecArray;
|
||||
|
|
|
@ -43,6 +43,17 @@ export class JSPSettingsTab extends PluginSettingTab {
|
|||
});
|
||||
});
|
||||
|
||||
new Setting(this.containerEl)
|
||||
.setName("Include Note Name")
|
||||
.setDesc("Whether the name of the shared note should be included in the share as a heading.")
|
||||
.addToggle(t => {
|
||||
t.setValue(this.plugin.settings.includeNoteName);
|
||||
t.onChange(async v => {
|
||||
this.plugin.settings.includeNoteName = v;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
this.containerEl.createEl("hr");
|
||||
this.containerEl.createEl("p", {text: "If you like this plugin and want to support its development, you can do so through my website by clicking this fancy image!"});
|
||||
this.containerEl.createEl("a", {href: "https://ellpeck.de/support"})
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
export const defaultSettings: JSPSettings = {
|
||||
url: "https://jsp.ellpeck.de",
|
||||
shared: [],
|
||||
stripFrontmatter: true
|
||||
stripFrontmatter: true,
|
||||
includeNoteName: true
|
||||
};
|
||||
|
||||
// TODO add a setting for auto-refreshing uploads when saving
|
||||
|
@ -11,6 +12,7 @@ export interface JSPSettings {
|
|||
url: string;
|
||||
shared: SharedItem[];
|
||||
stripFrontmatter: boolean;
|
||||
includeNoteName: boolean;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
{
|
||||
"url": "https://jsp.ellpeck.de",
|
||||
"shared": [
|
||||
{
|
||||
"id": "3c781ebc",
|
||||
"password": "7eae9eea1f7503f6f236b242d45657e6",
|
||||
"path": "Cool Test Note.md"
|
||||
},
|
||||
{
|
||||
"id": "d47f7765",
|
||||
"password": "513115b756d9ddebd3afd6efe4c248c6",
|
||||
"path": "Even cooler note.md"
|
||||
}
|
||||
],
|
||||
"stripFrontmatter": true
|
||||
"url": "http://localhost:8080",
|
||||
"shared": [],
|
||||
"stripFrontmatter": true,
|
||||
"includeNoteName": true
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
test: yes
|
||||
---
|
||||
# Cool Test Note
|
||||
|
||||
This is a cool test note, my friends!
|
||||
|
||||
|
|
Loading…
Reference in a new issue