vault backup: 2026-09-28 07:57:07
This commit is contained in:
+12
-1
@@ -143,6 +143,17 @@ var YuquePublishSettingTab = class extends import_obsidian3.PluginSettingTab {
|
||||
}
|
||||
};
|
||||
|
||||
// src/frontmatter.ts
|
||||
function stripFrontMatter(content, boundary) {
|
||||
if (!boundary.exists) {
|
||||
if (/^---(?:\r?\n|$)/.test(content)) {
|
||||
throw new Error("Front matter is not closed with a --- delimiter");
|
||||
}
|
||||
throw new Error("No front matter found in the document");
|
||||
}
|
||||
return content.slice(boundary.contentStart);
|
||||
}
|
||||
|
||||
// src/main.ts
|
||||
var YuquePublishPlugin = class extends import_obsidian4.Plugin {
|
||||
constructor(app, manifest) {
|
||||
@@ -171,6 +182,7 @@ var YuquePublishPlugin = class extends import_obsidian4.Plugin {
|
||||
async publishToYuque(file) {
|
||||
var _a;
|
||||
const content = await this.app.vault.read(file);
|
||||
const contentWithoutFrontMatter = stripFrontMatter(content, (0, import_obsidian4.getFrontMatterInfo)(content));
|
||||
const frontMatter = (_a = this.app.metadataCache.getFileCache(file)) == null ? void 0 : _a.frontmatter;
|
||||
if (!frontMatter) {
|
||||
throw new Error("No front matter found in the document");
|
||||
@@ -221,7 +233,6 @@ var YuquePublishPlugin = class extends import_obsidian4.Plugin {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const contentWithoutFrontMatter = content.split("---")[2] || content;
|
||||
const payload = {
|
||||
slug: docSlug,
|
||||
title,
|
||||
|
||||
Reference in New Issue
Block a user