Skip to content

karstenpedersen/obsidian-advanced-random-note

Repository files navigation

Advanced Random Note Obsidian Plugin

This plugin enables you to create custom queries for opening random notes. This can be done through its own query language, Dataview, and/or regular expressions.

Features

  • Find random files using custom queries
  • Customize queryes through a custom modal
  • Enable queries as commands to execute them with ease.
  • Disable folders from being included in the searches.
  • Choose if notes should open in new tabs.
  • Commands:
    • Open random note modal: Open modal to select a query.
    • Open random note: Open random note (only markdown files).
    • Open random file: Open random file (all file types).

Settings Tab

Settings Image Query Edit Modal Image

Installation

Obsidian

  1. Open Settings.
  2. Go to "Community Plugins".
  3. Enable community plugins by pressing "Turn on community plugins".
  4. Click "Browse" to browse available community plugins.
  5. Search for "Advanced Random Note".
  6. Click Install and enable the plugin.
  7. Close the community plugins window.

Getting Started

Queries

This plugin uses three different query languages:

  1. Custom language inspired by Obsidian Search.
  2. Dataview
  3. Regular expressions

Custom query language

Tags

You can query files by their tags. Do this by specifying the tag: keyword. After this, you can write multiple tags that should be included and excluded from the file.

  • If tags should not be in the file, then write ! in front of them, like this: tag: idea !complete. This will get files that have the idea tag, but not the complete tag.
  • You can also write # in front of the tags, like this: #idea and !#complete,
Paths

You can query files by their path. To do this, specify the path: keyword and write what the path should contain to be included in the result.

Filename

You can query files by their filename. To do this, specify the file: keyword and write what the filename should contain to be included in the result.

Examples
  • Find ideas that are not completed: tag: idea !complete
  • Find untitled files: file: Untitled.
  • Find fleeting notes in root directory: path: / tag: fleeting.

Dataview

Install and enable Dataview through community plugins and reload Obsidian. You can find more information about Dataview queries in their documentation.

Note: This plugin only allows for list queries, like this one:

LIST
FROM #idea

Regular Expressions

Another query type is regular expressions

Examples
  • Find image from attachments: ^attachments\/.*?[.](png|jpg)

Disabled Folders

You can disable folders to remove them from being searched. This can be useful if you have a template folder that you do not want to open files from.

Note: Queries can disable the use of this setting, meaning that you can create some queries which searches from them.

Enable Queries as Commands

Queries can be enabled as commands by clicking the toggle next to them when on the plugins settings tab. This can be useful in combination with the Commander plugin.

Version History

Version 0.0.11

  • Add ribbon button.
  • Open random note in folder using file right-click menu.
  • Open random notes in new windows.

Version 0.0.10

  • Fix opening other types of files other than markdown files.

Version 0.0.9

  • Fix disabled folders.
  • Fix open file in new leaf setting.

Version 0.0.8

  • Add custom query editor modal.
  • Add query types:
    • Search using Dataview.
    • Search using regular expressions.
  • Add queries will now also search for other filetypes.
  • Fix root folder query in custom query language.

Version 0.0.7

  • Fix frontmatter tags to also be included in queries.

Version 0.0.6

  • Add Open Random Note command.
  • Add Open Random Note Modal command.
  • Add plugin settings tab.
  • Add user queries.
  • Add ability to toggle user queries as commands.

Contact

  • Get in contact on the plugins GitHub.