# LineRef Copier LineRef Copier is a local Obsidian plugin for copying precise Markdown note references from the cursor line, a selected phrase on one line, or a selected range across multiple lines. Its main purpose is to help you interact with AI agents more precisely. Instead of describing "the sentence inside the long paragraph near the middle of this note", you can copy an exact index and paste it into an AI conversation, task, issue, or prompt. This gives the agent a concrete location to inspect or discuss. LineRef Copier supports three reference levels: - Cursor line: `Projects/Research/idea.md:25` - Single-line selection: `Projects/Research/idea.md:25:8-42` - Multi-line selection: `Projects/Research/idea.md:25:8-27:19` ## Features - Copy the current cursor line as an AI-friendly location index, such as `path/to/file.md:25`. - Copy a single selected phrase with line and column positions. - Copy a multi-line selection with start and end line-column positions. - Choose between relative vault paths and absolute local file paths. - Run the command from the command palette or record a custom shortcut in the plugin settings. - Optionally show a notification after copying, including the copied reference. ## Usage Open a Markdown note, then run **Copy line reference** from the command palette in one of these situations: - Place the cursor on a line to copy that line reference. - Select text within one line to copy the line and column range. - Select text across multiple lines to copy the start and end line-column range. Paste the copied reference into your AI agent chat when you want the agent to locate a specific note position. When **Copy notice** is enabled, Obsidian shows a notice like: ```text LineRef Copier: copied Projects/Research/idea.md:25:8-27:19 ``` ## Output format Cursor line: ```text filePath:lineNumber ``` Example: ```text Projects/Research/idea.md:25 ``` Single-line selection: ```text filePath:lineNumber:startColumn-endColumn ``` Example: ```text Projects/Research/idea.md:25:8-42 ``` Multi-line selection: ```text filePath:startLine:startColumn-endLine:endColumn ``` Example: ```text Projects/Research/idea.md:25:8-27:19 ``` Line and column numbers are 1-based, matching what people usually expect when discussing files. For selections, the copied range points from the first selected character to the selection end position. ## Settings Open **Settings -> Community plugins -> LineRef Copier**. - **Path mode** controls whether copied references use a relative vault path or an absolute local file path. - **Copy notice** controls whether successful copies show a notice with the copied reference. - **Custom shortcut** records a plugin-level shortcut. Select **Clear** to remove it. If absolute paths are unavailable in the current Obsidian environment, the plugin falls back to the relative path and shows a notice. ## Development Install dependencies: ```bash npm install ``` Build the plugin: ```bash npm run build ``` Run lint checks: ```bash npm run lint ``` During local testing, reload the plugin in Obsidian after rebuilding so the latest `main.js` is loaded. ## Release with GitHub Actions This repository includes a release workflow at `.github/workflows/release.yml`. It runs when you push a Git tag, builds the plugin, then creates a draft GitHub Release and uploads: - `main.js` - `manifest.json` - `styles.css` Recommended release steps: 1. Make sure `manifest.json` version and `versions.json` are updated (for example `1.0.1`). 2. Commit your changes. 3. Create a tag that exactly matches the plugin version (no `v` prefix), such as `1.0.1`. 4. Push commit and tag to GitHub. 5. Open GitHub Releases, review the generated draft release, then publish it. ## Privacy LineRef Copier works locally. It does not make network requests, collect analytics, upload vault content, or send file paths outside Obsidian.