Obsidian Coffeebean Edition Documentation

website·Indexed 32 days ago

https://coffeetea.top/

A guide to advanced Obsidian usage and best practices, covering high-level workflow settings, plugin development, custom style guides, data synchronization, backup strategies, automation, and advanced search techniques.

Tokens
1.1K
Snippets
2
Records
3
Agent score
9%

What's inside Obsidian

  1. Use Callout blocks in Obsidian Markdown

    Obsidian provides full support for standard Markdown syntax, including tables, mathematical formulas, and code blocks. Additionally, it enhances standard Markdown by supporting 'callout' blocks for highlighted or annotated content.
  2. Create an Obsidian plugin manager dashboard using DataviewJS

    This DataviewJS script creates an interactive dashboard within Obsidian to manage installed plugins. It lists all plugins from the app manifest, displays their current enabled/disabled status, and provides buttons to toggle plugin states and open plugin settings. It relies on the 'Advanced URI' plugin to execute the enable/disable and settings actions via obsidian://advanced-uri links.
    const reFreshPageButtonMaker = (intest) => {
      const freshButton = this.container.createEl("button");
      freshButton.innerHTML = intest;
      freshButton.addEventListener("click", async (evt) => {
        let content = app.vault.adapter.read(dv.current().file.path);
        app.vault.adapter.append(dv.current().file.path, "\na");
        content.then((content) => { app.vault.adapter.write(dv.current().file.path, content); });
      })
      return freshButton;
    };
    
    dv.el("center", "当前已启用【" + app.plugins.enabledPlugins.size + "】个插件");
    dv.el("br","")
    dv.el("center", reFreshPageButtonMaker("点此刷新本页"));
    
    let list = [];
    let namel = 0;
    for (let i = 0; i < Object.keys(app.plugins.manifests).length; i++) {
      let pluginId = Object.keys(app.plugins.manifests)[i];
      let pluginManifest = app.plugins.manifests[pluginId];
      
      if (namel < pluginManifest.name.length) {
        namel = pluginManifest.name.length;
      }
      
      let name = '<a href="obsidian://advanced-uri?settingid=' + encodeURI(pluginId) + '">' + pluginManifest.name + "</a>";
      let status = "[<button>🔴</button>](obsidian://advanced-uri?enable-plugin=" + encodeURI(pluginId) + ")";
      
      if (Array.from(app.plugins.enabledPlugins).indexOf(pluginId) != -1) {
        status = "[<button>✔</button>](obsidian://advanced-uri?disable-plugin=" + encodeURI(pluginId) + ")";
      }
      
      let x = ["<div align=center>" + name + "</div >", status];
      list.push(x);
    }
    
    list = list.sort(function (a, b) {
      return a[0].split(">")[2].slice(0,-3).length - b[0].split(">")[2].slice(0,-3).length
    }).sort(function (a, b) {
      return a[1].includes("🔴") - b[1].includes("🔴");
    });
    
    dv.el("div", dv.el("div", dv.markdownTable(["<div align=right>插件设置</div ", "<div align=left>状态</div>"], list), { attr: { style: "width:" + (namel / 1.25) + "em" } }), { attr: { align: "center" } });
  3. Manage Obsidian plugins using DataviewJS and Advanced URI

    This DataviewJS script creates a dynamic dashboard within Obsidian to view installed plugins, check their enabled/disabled status, and toggle them on or off using the obsidian://advanced-uri protocol. It also includes a 'Refresh' button that forces the page to reload by performing a dummy write operation to the current file.
    const reFreshPageButtonMaker = (intest) => {
      const freshButton = this.container.createEl("button");
      freshButton.innerHTML = intest;
      freshButton.addEventListener("click", async (evt) => {
        let content = app.vault.adapter.read(dv.current().file.path);
        app.vault.adapter.append(dv.current().file.path, "\na");
        content.then((content) => { app.vault.adapter.write(dv.current().file.path, content); });
      })
      return freshButton;
    };
    
    dv.el("center", "当前已启用【" + app.plugins.enabledPlugins.size + "】个插件");
    dv.el("br","")
    dv.el("center", reFreshPageButtonMaker("点此刷新本页"));
    
    let list = [];
    let namel = 0;
    for (let i = 0; i < Object.keys(app.plugins.manifests).length; i++) {
      let pluginId = Object.keys(app.plugins.manifests)[i];
      let manifest = app.plugins.manifests[pluginId];
      
      if (namel < manifest.name.length) {
        namel = manifest.name.length;
      }
      
      let name = '<a href="obsidian://advanced-uri?settingid=' + encodeURI(pluginId) + '">' + manifest.name + "</a>";
      let status = "[<button>🔴</button>](obsidian://advanced-uri?enable-plugin=" + encodeURI(pluginId) + ")";
      
      if (Array.from(app.plugins.enabledPlugins).indexOf(pluginId) != -1) {
        status = "[<button>✔</button>](obsidian://advanced-uri?disable-plugin=" + encodeURI(pluginId) + ")";
      }
      
      let x = ["<div align=center>" + name + "</div>", status];
      list.push(x);
    }
    
    list = list.sort(function (a, b) {return a[0].split(">")[2].slice(0,-3).length- b[0].split(">")[2].slice(0,-3).length}).sort(function (a, b) { return a[1].includes("🔴") - b[1].includes("🔴"); });
    
    dv.el("div", dv.el("div", dv.markdownTable(["<div align=right>插件设置</div>", "<div align=left>状态</div>"], list), { attr: { style: "width:" + (namel / 1.25) + "em" } }), { attr: { align: "center" } });