Skip to content

Commit 474cc59

Browse files
committed
chore: Add repo metadata and use cached vault reads
1 parent 6a6157b commit 474cc59

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

main.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class HtmlView extends FileView {
1919
}
2020

2121
async onLoadFile(file: TFile): Promise<void> {
22-
const content = await this.app.vault.read(file);
22+
const content = await this.app.vault.cachedRead(file);
2323
this.render(content);
2424
}
2525

@@ -75,15 +75,13 @@ export default class HtmlDocsPlugin extends Plugin {
7575
this.registerExtensions(["html", "htm"], VIEW_TYPE_HTML);
7676

7777
// Obsidian hides files with unrecognized extensions in the file
78-
// explorer unless 'Detect all file extensions' is on; registering
79-
// the extension only routes the view, it doesn't add to that
80-
// filter. Without this setting, the user never sees their .html
81-
// files in the explorer.
78+
// explorer unless "Show all file types" is on; registering the
79+
// extension only routes the view, it doesn't add to that filter.
8280
const vault = this.app.vault as { getConfig?: (key: string) => unknown };
8381
const showUnsupported = vault.getConfig?.("showUnsupportedFiles");
8482
if (showUnsupported === false) {
8583
new Notice(
86-
"HTML Docs: enable 'Detect all file extensions' in Settings → Files & Links to see .html files in the file explorer.",
84+
"To see .html files in your file explorer, please enable 'Show all file types' in Settings → Files & Links.",
8785
10000,
8886
);
8987
}

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
"html",
1414
"obsidian-plugin"
1515
],
16+
"homepage": "https://github.com/smcllns/obsidian-plugin-html-docs#readme",
17+
"bugs": {
18+
"url": "https://github.com/smcllns/obsidian-plugin-html-docs/issues"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/smcllns/obsidian-plugin-html-docs.git"
23+
},
1624
"author": "smcllns",
1725
"license": "MIT",
1826
"devDependencies": {

test/fixture.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ <h2>Known not to work (by design)</h2>
244244

245245
(function () {
246246
let n = 0;
247-
const id = setInterval(() => { n++; if (n >= 2) clearInterval(id); }, 40);
247+
const id = setInterval(() => { n++; if (n >= 2) clearInterval(id); }, 100);
248248
setTimeout(() => {
249-
card('js', 'setInterval / setTimeout', n >= 2 ? 'pass' : 'fail', 'ticked ' + n + ' time(s) in 200ms');
249+
card('js', 'setInterval / setTimeout', n >= 2 ? 'pass' : 'fail', 'ticked ' + n + ' time(s) in 1200ms');
250250
pending.interval = true; maybeFinalize();
251-
}, 200);
251+
}, 1200);
252252
})();
253253

254254
// === Graphics ===

0 commit comments

Comments
 (0)