Note Toolbar Documentation

repository·master·Indexed 20 days ago

https://github.com/chrisgurney/obsidian-note-toolbar

Documentation for the obsidian-note-toolbar plugin (v1.34.12), which adds customizable, context-aware toolbars to Obsidian notes. Includes guides on installation, using the Note Toolbar Gallery, configuring display rules, and utilizing the ntb API and CLI for advanced automation and AI agent integration.

Tokens
16.3K
Snippets
45
Records
97
Agent score
66%

What's inside Note Toolbar

  1. Overview of Note Toolbar features

    master

    Note Toolbar allows you to create custom toolbars tailored to specific notes. Key capabilities include:

    • Custom Items: Add commands, file/folder links, URIs/URLs, menus, and scripts (Dataview, JS Engine, Templater, or built-in JavaScript).
    • Dynamic Display: Define where toolbars appear based on folders or user-defined properties. Positions include below properties, top/bottom of note, tab bar, or as floating buttons.
    • Contextual Toolbars: Show toolbars when text is selected or replace the New Tab view with a custom launchpad.
    • Rich Customization: Use Obsidian icons, emojis, and tooltips. Customize visibility for mobile vs. desktop and choose between icon-only, label-only, or both.
    • Dynamic Content: Use Variables and script expressions to inject note titles or properties into labels, tooltips, or URIs.
    • Advanced Placement: Use Note Toolbar Callouts to place toolbars anywhere within a note.
    • Sharing: Share toolbars as links or callouts.
    • Styling: Fine-tune appearance (borders, sticky scrolling, alignment, button/tab styles) and use the Style Settings Plugin for deep customization.
    • Automation & API: Use Note Toolbar URIs to trigger actions from anywhere in your vault, and use the Note Toolbar API within scripts (Dataview JS, etc.) to trigger UI elements like prompts or menus.
  2. Use the Note Toolbar `ntb` API for scripting

    master

    The ntb API allows you to write, edit, or debug JavaScript within Obsidian to extend the Note Toolbar functionality. You can use it to:

    • Create UI elements: Use ntb.prompt, ntb.suggester, ntb.fileSuggester, ntb.menu, or ntb.modal to interact with the user.
    • Manage note properties: Read or write note properties using ntb.getProperty and ntb.setProperty.
    • Manipulate toolbar items: Access or modify existing items using ntb.getItem or ntb.getToolbars.
    • Integrate with other plugins: Combine the ntb API with Dataview JS, JS Engine, or Templater.

    Important: Always fetch the full API reference from the official source before writing or editing scripts to ensure accuracy.

  3. Explore advanced toolbar features

    master

    Beyond standard markdown notes, you can extend Note Toolbar functionality:

    • Item Types: Create items for commands, file/folder links, websites/URIs, menus, groups, and scripts (supporting Dataview, Templater, and JavaScript).
    • App-wide Toolbars: Enable Toolbars within the app in settings to access toolbars in the New tab view, the mobile Navigation bar, and other areas.
    • Non-Markdown Files: Toolbars can be displayed in Canvases, PDFs, and video files.
    • In-note Placement: Use Note Toolbar Callouts to place a toolbar in the middle of your note content rather than at the top.
  4. Explore advanced toolbar items and locations

    master

    Item Types

    Beyond simple commands, you can create toolbar items for:

    • File and folder links
    • Websites/URIs
    • Menus
    • Groups
    • Scripts (supporting Dataview, Templater, and JavaScript)

    Alternative Locations

    Toolbars are not limited to the top of markdown notes. You can also use them in:

    • App-wide locations: Via the Toolbars within the app setting (e.g., New tab view, mobile Navigation bar).
    • Non-markdown files: Such as Canvases, PDFs, and video files.
    • Inside note content: Using Note Toolbar Callouts to place toolbars in the middle of a note.
  5. Overview of the `ntb` API namespaces

    master

    The ntb object is the primary entry point for interacting with the plugin. It is organized into several functional namespaces:

    • Note Manipulation: Methods for interacting with note properties and selections (e.g., ntb.getProperty, ntb.getSelection).
    • Toolbars: Methods for managing and accessing toolbar instances and items (e.g., ntb.getToolbars, ntb.getActiveItem).
    • UI Components: Methods for displaying user interface elements like prompts, menus, modals, and suggesters (e.g., ntb.prompt, ntb.menu).
    • Utilities: Helper objects for common tasks, including access to the Obsidian app, clipboard operations, and shorthand utilities ntb.o and ntb.t.
  6. Use Dynamic Values in Toolbar Items

    master

    Instead of hard-coding dates or note names, use Note Toolbar variables within URI items. This makes toolbar items context-aware.

    Supported Variable Types:

    • Standard Variables: {{note_title}}, {{file_path}}, and properties like {{prop_NAME}}.
    • Expressions: You can embed logic using:
      • {{js: ...}} (JavaScript)
      • {{dv: ...}} (Dataview)
      • {{tp: ...}} (Templater)
  7. Configure encoding and empty-state behavior for variables

    master

    Note Toolbar provides two specialized modifiers for variables used in configuration fields:

    1. URL Encoding: Use the encode: prefix before a variable to ensure its value is safely encoded for use in URIs (e.g., {{encode:file_path}}).
    2. Hide on Empty: You can configure items to hide if the resolved variable value is empty, preventing broken or useless buttons from appearing in the toolbar.
  8. Release a beta version using feature branches

    master

    If you want to test a beta version using a feature branch and the BRAT plugin:

    1. Create a new feature branch and make your changes.
    2. Update WHATSNEW_VERSION in NoteToolbarSettings.ts.
    3. Run the release command with a beta version string:
      npm run release 1.xx-beta-01
    4. Go to the GitHub releases page, edit the release, and Set as a pre-release.
    5. Use the BRAT plugin in Obsidian to install the latest version.
    npm run release 1.xx-beta-01
  9. Use the Note Toolbar CLI via Obsidian CLI

    master

    The Note Toolbar CLI allows you to interact with a running Obsidian instance to manage toolbars and items (commands, links, scripts, etc.) without manually editing configuration files.

    Prerequisites:

    • Obsidian must be open.
    • The Note Toolbar plugin must be installed and enabled.
    • The obsidian CLI must be installed and configured to interact with your instance.

    Warning: Do NOT modify the plugin's data.json file directly or use Obsidian's eval command to bypass the CLI; use the provided commands instead.

    obsidian note-toolbar:help
  10. Use Note Toolbar Skills with AI agents

    master

    Once the skills are installed in your agent's directory, the agent will automatically select the appropriate skill when your request matches the skill's capabilities. You can also explicitly invoke a skill by referencing the Note Toolbar CLI or API in your prompt.

    Example prompt:

    "Using the Note Toolbar CLI, create a toolbar called Formatting and add a Bold command item to it."