Skip to content

add section flag to open command#74

Merged
Yakitrak merged 1 commit into
Yakitrak:mainfrom
satputekuldip:issue-71-open-in-section
Feb 1, 2026
Merged

add section flag to open command#74
Yakitrak merged 1 commit into
Yakitrak:mainfrom
satputekuldip:issue-71-open-in-section

Conversation

@satputekuldip

Copy link
Copy Markdown
Contributor

Add open --section heading navigation

Description

  • Introduced --section flag to open notes at a specific heading.
  • Updated OpenParams to include Section.
  • Modified OpenNote to append #<heading> to the file parameter.
  • Enhanced tests to cover section behavior.
  • Updated README with new open --section usage.

Motivation and Context
Issue #71 requests direct section navigation when opening long notes. This change allows users to jump to an exact heading using Obsidian’s URI behavior, while keeping default open behavior unchanged.

Checklist:

  • I have written unit tests for my changes.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.

- Introduced `--section` flag to allow opening notes at specific headings.
- Updated `OpenParams` struct to include `Section`.
- Modified `OpenNote` function to handle section parameter.
- Enhanced tests to verify functionality with sections.
@satputekuldip

Copy link
Copy Markdown
Contributor Author

got reference from this discussion

https://forum.obsidian.md/t/url-scheme-direct-navigation-to-heading/5907/25

Screenshot 2026-01-31 at 8 50 53 PM

Opened here like this

Screenshot 2026-01-31 at 8 51 10 PM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds section navigation support to the open command, allowing users to jump directly to specific headings in long Obsidian notes.

Changes:

  • Added --section flag to the open command for direct heading navigation
  • Updated OpenParams struct and OpenNote function to support section parameter
  • Enhanced test coverage with section-specific test cases
  • Updated README with usage examples for the new flag

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/actions/open.go Added Section field to OpenParams and logic to append section to file parameter when specified
pkg/actions/open_test.go Added test assertions for section parameter handling and new test case for section navigation
mocks/uri.go Enhanced MockUriManager to track LastBase and LastParams for better test assertions
cmd/open.go Added sectionName variable and --section flag to the open command CLI
README.md Added documentation and usage examples for the new --section flag

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@satputekuldip

Copy link
Copy Markdown
Contributor Author

I think review is done…

@Yakitrak Yakitrak left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Yakitrak Yakitrak merged commit df350a4 into Yakitrak:main Feb 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants