Advice lets a plugin wrap or replace a function or React component owned by another plugin, without modifying the original source. This API is inspired from Emacs, whereDocumentation Index
Fetch the complete documentation index at: https://zenbulabs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
defadvice is used to modify existing functions without editing their source.
Registering advice
Callthis.advise(...) from inside a service:
| Field | Meaning |
|---|---|
view | View type to apply the advice in. "*" for every view. |
moduleId | Suffix of the source file that exports the target. |
name | Name of the export to advise. |
type | One of "replace", "before", "after", "around". |
modulePath | Path to your wrapper module, relative to the plugin root (or absolute). |
exportName | Named export inside the wrapper module. |
setup cleanup.
Around advice
Receives the original as__original in props, making it the most flexible advice type.
src/content/wrap-counter.tsx
Replace advice
Substitutes the export entirely. The wrapper is used in place of the original.Before / After
before and after advice run extra logic around the original function.
Hot reloading
Adding, removing, or editing athis.advise(...) call reloads the affected views so the new advice takes effect. Edits inside the advice module itself hot-replace through Vite’s normal HMR.
