Skip to content

Commit

Permalink
fix: prepend with frontmatter
Browse files Browse the repository at this point in the history
close #148
  • Loading branch information
Vinzent03 committed Feb 1, 2024
1 parent c9b05af commit fb39d06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,11 @@ export default class AdvancedURI extends Plugin {
const fileData = await this.app.vault.read(file);
const cache = this.app.metadataCache.getFileCache(file);

if (cache.frontmatter) {
const line = cache.frontmatter.position.end.line;
if (
cache.sections[0].type == "yaml" &&
cache.sections[0].position.start.line == 0
) {
const line = cache.sections[0].position.end.line;
const first = fileData
.split("\n")
.slice(0, line + 1)
Expand Down
8 changes: 4 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ declare module "obsidian" {
} | null;
plugins: {
[key: string]: {
disable(_:boolean): void;
enable(_:boolean): void;
}
}
disable(_: boolean): void;
enable(_: boolean): void;
};
};
};
}
interface Bookmark {
Expand Down

0 comments on commit fb39d06

Please sign in to comment.