joekrill / silverbullet-treeview

SilverBullet TreeView plug
MIT License
41 stars 11 forks source link

Regex and tag filter issues #26

Closed tmichela closed 2 months ago

tmichela commented 2 months ago

It looks like regex filter does not work if a page has children. E.g. filtering the Library does not work with regex. However it works with the space-script filter, e.g.:

silverbullet.registerFunction({name: "filterLibrary"}, async (page) => {
  if (page.name.startsWith("Library/")) {
    return true;
  }
  return false;
});

I'm using the current edge release of sb, and the latest version of the treeview plug.

tmichela commented 2 months ago

Ah, nevermind. The issue is that I was confused with the example given:

rule: "^(?:SETTINGS|PLUGS|index|Library)$"

which won't work for Library since it has children pages that won't be filtered by this rule, but this does:

rule: "Library"