Skip to content

Official Smart Plugins site

Smart Plugins are independent third-party plugins for Obsidian. Smart Connections is the flagship plugin.

Smart Context codeblock

The smart-context codeblock turns a note into a visible context manifest.

Use it when the note body holds the instructions and the codeblock holds the exact notes, named contexts, folders, or files that should travel with those instructions.

Supported aliases

All three aliases render the same UI:

```ctx
Project/Spec.md
ctx:: Backend notes
```

The original alias is preserved when the block is rewritten.
Named-context lines rewritten into the block also reuse that same alias.

What renders in the note

The rendered header stays compact:

When the block is empty:

Once the block has active items, the copy button appears:

Secondary actions live under the menu:

Insert and edit the codeblock

Use the command that matches the installed plugin.

Core:

Pro:

Both commands:

The builder uses the current plugin's available context_suggest_* actions, so Pro automatically adds external suggestions while Core stays note and named-context focused.

What goes inside the block

A codeblock can contain:

Internal vault folder example:

```smart-context
Projects/Alpha
!Projects/Alpha/generated
!*.test.js
```

Selecting Projects/Alpha in the builder writes one folder line.
The parser expands that folder line into concrete context items when hydrating the note-scoped #codeblock context.
Excluding a subtree writes one excluded folder line instead of one line per excluded child item.

External folder example (Pro):

```smart-context
../my-repo
!../my-repo/dist
!*.test.js
```

Selecting ../my-repo writes one folder line.
The parser expands that line back into concrete external file items during hydration while respecting .gitignore, .scignore, plugin ignore settings, and in-block exclusions.

Rendered raw source example:

Named-context example:

```ctx
ctx:: Meaningful name 2026-03-20
```

Rendered raw named-context example:


## Page content replacement for `## Excluding noise`

```md
## Excluding noise

Prefix a line with `!` to exclude a file, folder, or simple glob pattern.

Internal vault folder example:

````md
```smart-context
Projects/Alpha
!Projects/Alpha/generated
!*.test.js

External folder example:

````md
```smart-context
../my-repo
!../my-repo/dist
!../my-repo/obsidian/obsidian.min.js
!*.md
```

This is especially useful when you want:

When you exclude a folder from a selected folder tree, the codeblock keeps the compact folder exclusion line instead of expanding every excluded child path.
Nested excluded folders collapse to the broadest excluded path during rewrites.

Copy behavior

Copy only the codeblock context

Use the codeblock copy button or the menu action.

This copies the concrete items already stored on the note's #codeblock context.

It does not trigger extra link-following for:

Copy the current note plus the codeblock context

Core:

Pro:

These commands:

That keeps the note instructions and the codeblock manifest together without re-expanding the block again during copy.


Named contexts inside codeblocks

Named contexts stay short in the block and expand only in the hydrated note-scoped context.

```smart-context
smart-context:: Backend notes
```

You can also convert a multi-entry codeblock into a named context from the menu.

The builder name input is codeblock-aware:

External files and folders (Pro)

The external selector is optimized for keyboard flow.

Key actions:

External folder includes respect:

Excluding noise

Prefix a line with ! to exclude a file, folder, or simple glob pattern.

```smart-context
../my-repo
!*.test.js
!../my-repo/dist
!../my-repo/obsidian/obsidian.min.js
```

This is especially useful when you want:


When to use a codeblock vs a named context

Use a codeblock when:

Use a named context when:

Related pages