Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save GithubUser5462/841a4c7525bf702b2f4012390caf6b01 to your computer and use it in GitHub Desktop.

Select an option

Save GithubUser5462/841a4c7525bf702b2f4012390caf6b01 to your computer and use it in GitHub Desktop.
Restore the pre-2026.2 working directory behavior for runnable Markdown code blocks in JetBrains IDEs.

Restore the old working directory for JetBrains Markdown code blocks

Starting with JetBrains IDEs based on the 2026.2 platform, runnable Markdown code blocks execute from the project root by default.

Previously, commands ran from the directory containing the Markdown file.

This can affect Markdown runbooks that use paths relative to the document:

project/
├── docs/
│   ├── maintenance.md
│   └── cleanup.sh
└── ...

Given this code block in docs/maintenance.md:

./cleanup.sh

The expected working directory may be project/docs, but the new default runs it from project, where ./cleanup.sh does not exist.

Restore the previous behavior

JetBrains provides a compatibility registry option:

markdown.command.runner.use.file.directory

To enable it:

  1. Press Ctrl+Shift+A to open Find Action.

  2. Search for Registry.

  3. Open the Registry action.

  4. Search for:

    markdown.command.runner.use.file.directory
    
  5. Enable the checkbox.

Runnable Markdown commands will now use the Markdown file's parent directory as their working directory, restoring the behavior from versions before 2026.2.

Sources

Comments are disabled for this gist.