Skip to content

Commit

Permalink
Prep for 0.5.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
catacgc committed Oct 6, 2024
1 parent b8762d8 commit 27e325f
Show file tree
Hide file tree
Showing 67 changed files with 2,101 additions and 760 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_style = space
indent_size = 4
tab_width = 4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ node_modules
# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js
styles.css
./styles.css

# Exclude sourcemaps
*.map
Expand Down
136 changes: 7 additions & 129 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,144 +1,22 @@
# Obsidian TreeSearch Plugin

Obsidian is good at linking notes together. What this plugin does is to add another layer to the linking
capabilities of Obsidian, namely hierarchical linking.
capabilities of Obsidian, namely hierarchical linking and in-context searching.

## Installing

- Install BRAT plugin from the Obsidian Community Plugins
- With Brat, install the TreeSearch plugin by adding a beta plugin with the following URL: https://github.com/catacgc/obsidian-tree-search
- Make sure you have Dataview installed

## Usage
## Features

### Simple Example
- [Zero-effort network of relations](/graph/build) between all notes in your vault: notes, headers, tasks, tags, and web pages
- Powerful, fast (and graph aware) search capabilities: [Search](/search/index)
- Supercharged backlinks view (File Context): [File Context](/file-context/index)
- In-page Markdown processor (`tree-context`) to show a map of content in a note: [Markdown Processor](/tree-context/index)
- Live update of the graph (as you type)

The idea is that you can link notes together in a hierarchy where the hierarchy is made up of nodes in the note.

Here's a simple example (try to reproduce in your vault). You have daily/weekly notes where you jolt down your references and notes through the day.

In `MyNotes.md` you have the following:

```markdown
# September

- [[Obsidian]]
- [Tree Search](https://github.com/catacgc/obsidian-tree-search) is awesome; install with [[BRAT]]
- [ ] check it out
```

Consider for a moment what can be derived from this simple note.
- Obsidian is a parent of `Tree Search`
- BRAT is referenced when mentioning `Tree Search`
- MyNotes#September is a parent of `Obsidian`
- `- [ ] check it out` is a task under `Tree Search`

Obsidian falls short in helping you visualize and search these relations. This is where TreeSearch comes in.

### Searching

The plugin creates a directed graph for all these elements and adds a new command `TreeSearch: Search` that opens a new pane with a search bar.

You can search for a note and see all the notes (and links) that are nested under it.

With our example, search for `obsidian`, and you will see the following:

![obsidian.png](obsidian.png)

Clicking on any result item will highlight the note where the relation was recorded. Clicking on the note or a web link will open it.

![img.png](click.png)

Going beyond this trivial example, you can imagine how powerful this can be for a large vault.
If you spend a minimal amount of time to create some MOC (Maps of Content) you can easily navigate and retrieve items in your vault.

## Advanced Example

Let's create a note to exemplify the full set of features of the plugin: 'Work.md'
Add an alias to this note: `Documentation`

```markdown
# My MOC
- [[MyCompany]]
- [[Projects]]
- [[Team]]
- [[Stakeholders]]

- [[Projects]]
- [[FirstProject]]
- [[SecondProject]]

- [[Team]]
- [[Joe]]
- [[John]]
# Tasks
- [ ] Finish the design document for [[FirstProject]]

# Notes
- [[FirstProject]]
- [Design Document](http://link) created by [[Joe]]

- Let [[John]] know about the recent change
```

### MOC (maps of content)

A very useful feature of the plugin is the ability to create a map of content and search them. Search Work or Documentation to see it in action.

![img.png](work.png)


### Nested search

You can use the `/` separator (configurable in settings) between keywords to match sub-trees. For example `projects / joe` will show all projects
where Joe was mentioned:

![img.png](nested.png)

## How it works

This plugin adds another layer to this Obsidian's linking system, namely hierarchical linking of List Nodes & Pages in the vault.

### Graph Nodes

Even if the plugin is called TreeSearch, the underlying data structure is a directed graph.

Nodes tracked by this plugin are:
- All vault notes
- List items that
- Have links to other notes
- Have links to web pages
- All virtual pages (notes that are not in the vault but are linked to)
- Headers (only if they have List items under them)

| Node | Type | Description |
|--------------------------------------------------------|--------------|------------------------------------------------------------------------------|
| `MyCompany.md` | Page | A note in the vault |
| `[[Projects]]` | Virtual Page | Whenever the page does not exist in the vault, but there's still a reference |
| `- [Design Document](http://link) created by [[Joe]]` | List Item | All vault lines that contain a Web or a Vault reference |
| `## Header` | Header | A header in a note, if it has List Item children |
| `- [ ] Task` | Task | A task in a note |

### Directed Edges

The plugin track relations between nodes. The relation have the direction implied by the outline:
- If a Page is under another Page, the first is a child of the second
- If a List Item is under another List Item, the first is a child of the second
- If a List Item is under a Header, the first is a child of the Header
- If a List Item is under a Page, the first is a child of the Page
- If a List Item contains multiple references to other Pages, all Pages are parents of the List Item
- Tasks are treated identical to List Items

## Other Features

- Exclude relations via tagging (#archive, configurable in settings)
- Web pages as first class citizens in the graph (any time a web page is referenced, it becomes a node)
- Page aliases support
- Flexible and fast search.
- Live update of the graph as you type.
- Parent property to link a note to another note without having to nest them (configurable in settings. Needs to be a list property)
- Search results point back to where the relation was recorded (when you click on them)
- Hotkey to quickly focus the search bar

## Found this useful?

Expand Down
6 changes: 6 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* [Installing](/)
* [Using it](usage.md "Supercharged backlinks")
* [Searching](search/index.md)
* [Feature: Markdown Processor](tree-context/index.md)
* [Feature: File Context](file-context/index.md)
* [How It Works](graph.md)
Binary file added docs/file-context/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/file-context/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/file-context/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# File Context

You can assign a key or use the command panel top open the File Context.
It shows all the current partents and children at depth for the current file.

The Pin button allows you to keep the context unchanged while you navigate the vault
(useful for organizing notes).

![img_1.png](img_1.png)

Of course, the graph of children and parents is built across the vault.
And you can navigate to any note by clicking on it which will highlight
where the relation was recorded.
34 changes: 34 additions & 0 deletions docs/graph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How it works

This plugin adds another layer to this Obsidian's linking system, namely hierarchical linking of List Nodes & Pages in the vault.

## Graph Nodes

Even if the plugin is called TreeSearch, the underlying data structure is a directed graph.

Nodes tracked by this plugin are:
- All vault notes
- List items that
- Have links to other notes
- Have links to web pages
- Have tags
- All virtual pages (notes that are not in the vault but are linked to)
- Headers (only if they have List items under them)

| Node | Type | Description |
|--------------------------------------------------------|--------------|------------------------------------------------------------------------------|
| `MyCompany.md` | Page | A note in the vault |
| `[[Projects]]` | Virtual Page | Whenever the page does not exist in the vault, but there's still a reference |
| `- [Design Document](http://link) created by [[Joe]]` | List Item | All vault lines that contain a Web or a Vault reference |
| `## Header` | Header | A header in a note, if it has List Item children |
| `- [ ] Task` | Task | A task in a note |

## Directed Edges

The plugin track relations between nodes. The relation have the direction implied by the outline:
- If a Page is under another Page, the first is a child of the second
- If a List Item is under another List Item, the first is a child of the second
- If a List Item is under a Header, the first is a child of the Header
- If a List Item is under a Page, the first is a child of the Page
- If a List Item contains multiple references to other Pages, all Pages are parents of the List Item
- Tasks are treated identical to List Items
12 changes: 12 additions & 0 deletions docs/graph/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Automatically building a graph

The plugin works by scanning (using dataview) all files in your vault and creating links based on the outline.
It doesn't stop only at notes, but also includes headers, tasks, tags, and web links.

Consider an example vault as follows:

![img_2.png](img_2.png)

On the right side you can see the full graph being built by the plugin for the root note.

(If you wonder how the Example Graph note is created have a look at the [tree-context](/tree-context/index) macro)
Binary file added docs/graph/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graph/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graph/img_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<script>
window.$docsify = {
name: 'Tree Search',
repo: 'https://github.com/catacgc/obsidian-tree-search'
repo: 'https://github.com/catacgc/obsidian-tree-search',
loadSidebar: true,
subMaxLevel: 3
}
</script>
<!-- Docsify v4 -->
Expand Down
Binary file added docs/search/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/search/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/search/img_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/search/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Searching

Search is the must powerful feature of this plugin. You can open a modal (Search Modal)
or a pane (Search) to search for a note and see all the notes (and links) that are nested under it.

This makes retrieval of atoms of information (notes, tasks, tags, headers, and web links) very easy.

Say that you search from a presentation at work. With a semi-structured vault,
you can start your search from "project" and use the search separator (. configured in settings)
to search for "ppt".

![img.png](img.png)

The surrounding notes are also shown to give you context.
You can now narrow further to a specific project.

![img_1.png](img_1.png)

Now that you have the presentation, there are three commands available:

- Enter -> open and highlight the line where that relation was recorded:

![img_2.png](img_2.png)

- Cmd/Ctrl + Enter -> open and **select** the line. This is useful for quickly moving atoms around.

- Shift + Enter -> open the first link or web link in the note. This effectively
makes the plugin a launcher for your notes and bookmarks.
Binary file added docs/tree-context/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/tree-context/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions docs/tree-context/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Tree Context

You can use the `tree-context` macro to show a map of content in a note.

## Usage

```tree-context
file: "[[Root]]" # Optional, the current file / header is inferred; use quotes
depth: 2 # Optional, default is 2
```


For a file with the following content:

<!-- ContextExample.md -->

```tree-context
depth: 2
```
<!-- auto detects the file -->
# Archive

```tree-context
depth: 2
```
<!-- auto detects the archive header -->


And the following files links anywhere in the vault:

- [[ContextExample]]
- a note #reminder

- [[ContextExample#Archive]]
- an archived note #reminder

The output in the file will be:
![img_1.png](img_1.png)
Loading

0 comments on commit 27e325f

Please sign in to comment.