snezhig_obsidian-front-matt.../docs/Processor.md
snezhig 3febbf05b0 docs: rewrite README and feature guides; add screenshot generator
Make onboarding simple and every feature easy to understand:

- README: one-line value prop, "what you get" list, 60-second quick
  start, fixed install link (drop #LAST_RELEASE#), documentation hub.
- Features.md: describe all 13 features in plain text with variants;
  add the missing Inline, Canvas and Backlink; expand Alias options.
- Templates.md: simple -> composite learning curve plus recipes;
  add a "how to read" intro to TemplateExamples.md.
- New Settings.md (Rules, Boot/Debug, commands) and FAQ.md.
- Processor.md: clarify when to reach for it.

Screenshot tooling (separate from the e2e test suite):

- tools/screenshots: headless-Obsidian generator driven by its own
  wdio config; `npm run shots:pretty` captures every feature off/on,
  spotlights the changed element, and frames each shot carbon-style.
- Regenerate all docs/img screenshots and add a before/after hero.
- Add sharp devDependency for framing and a board.canvas fixture for
  the Canvas capture.
2026-06-26 13:58:10 +03:00

2.6 KiB

Processor

The Processor is an advanced, optional step that runs after a title is resolved from your template and transforms it further. Reach for it only when templates alone can't get the result you want — for example stripping a prefix, reformatting a date, or building a title with custom logic.

It offers three modes: Replace (a regular expression), Function (custom JavaScript), and Function V2 (custom JavaScript with file context). The latter two require some JavaScript knowledge.

By default, the processor is disabled.

Replace

In this mode processor will use RegExp to modify title.

img.png

Plugin uses the following template:

title.replace(new RegExp("#pattern#", "#flags#"), "#relacement#");

Where:

  • title - resolved title by settings. Not original filename.
  • replace - Doc
  • new Regexp - Doc
  • #pattern# - value from Pattern setting inside Processor
  • #flags# - value from Flags setting inside Processor
  • #replacement# - value from Replacement setting inside Processor

For example, you have set up plugin to pull new title from new_title path and this key has foo value. After plugin resolves foo title it will execute the following construction:

//It will return "bar" as new value
'foo'.replace(new RegExp('foo'), 'bar');

In this case bar value will be used as shown title

Function

In this mode processor will use custom function you write inside text area: img.png

You can read more about this logic here Inside your function you will be able to use title variable which contains resolved title. A value returned by your function will be used as shown title

FunctionV2

Works same as Function, but the argument is the object instead of string; Object your function will give an argument:

// Object that will be given into FunctionV2 processor as an "obj" argument
import {TFile} from "obsidian";

export type FunctionV2ObjArg = {
    // New file title
    title: string;
    // Path to file
    path: string;
    // Obisian's TFile
    file: TFile | null;
};

Example of text area:

//just for debugging
console.debug(obj)

return obj.title + '-title-in-' + obj.path