Skip to content

Commit

Permalink
1. NonactiveNoteIO: use vault.cachedRead instead of vault.read just l…
Browse files Browse the repository at this point in the history
…ike 0.6.11 did (this will improve indexing performance by avoiding repeatedly reading file content from disk) / 2. Add deplication note for preset theorem callout styles
  • Loading branch information
RyotaUshio committed Sep 17, 2023
1 parent 1b4e1c8 commit 478f6d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/file_io.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, CachedMetadata, Editor, MarkdownView, Pos, TFile } from "obsidian";
import { CachedMetadata, Editor, MarkdownView, Pos, TFile } from "obsidian";

import MathBooster from "./main";
import { insertAt, isEditingView, locToEditorPosition, splitIntoLines } from "./utils";
Expand Down Expand Up @@ -107,13 +107,13 @@ export class NonActiveNoteIO extends FileIO {
}

async getLine(lineNumber: number): Promise<string> {
const data = await this.plugin.app.vault.read(this.file);
const data = await this.plugin.app.vault.cachedRead(this.file);
const lines = splitIntoLines(data);
return lines[lineNumber];
}

async getRange(position: Pos): Promise<string> {
const content = await this.plugin.app.vault.read(this.file);
const content = await this.plugin.app.vault.cachedRead(this.file);
return content.slice(position.start.offset, position.end.offset);
}

Expand Down
2 changes: 1 addition & 1 deletion src/settings/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class MathContextSettingsHelper extends SettingsHelper<MathContextSetting
styleSetting.descEl.replaceChildren(
"Choose between your custom style and preset styles. You will need to reload the note to see the changes. See the ",
createEl("a", { text: "documentation", attr: { href: "https://ryotaushio.github.io/obsidian-math-booster/style-your-theorems.html" } }),
" for how to customize the appearance of theorem callouts.",
" for how to customize the appearance of theorem callouts. \"Custom\" is recommended, since it will give you the most control. You can view the CSS snippets for all the preset styles in the documentation or README on GitHub. The preset styles are only for a trial purpose, and they might not work well with some non-default themes.",
);
this.addToggleSetting("theoremCalloutFontInherit", "Don't override the app's font setting when using preset styles", "You will need to reload the note to see the changes.");
this.addTextSetting("titleSuffix", "Title suffix", "Ex) \"\" > Definition 2 (Group) / \".\" > Definition 2 (Group).");
Expand Down

0 comments on commit 478f6d1

Please sign in to comment.