{"id":17924999,"url":"https://github.com/zerowidth/gh-md","last_synced_at":"2025-03-24T03:30:58.283Z","repository":{"id":66410104,"uuid":"572711872","full_name":"zerowidth/gh-md","owner":"zerowidth","description":"gh-cli extension to create markdown links and issue references","archived":false,"fork":false,"pushed_at":"2024-03-08T00:22:45.000Z","size":36,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T02:38:42.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerowidth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-30T21:42:19.000Z","updated_at":"2024-08-28T02:28:12.000Z","dependencies_parsed_at":"2024-03-08T01:29:48.576Z","dependency_job_id":null,"html_url":"https://github.com/zerowidth/gh-md","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fgh-md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fgh-md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fgh-md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Fgh-md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerowidth","download_url":"https://codeload.github.com/zerowidth/gh-md/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245204458,"owners_count":20577352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T20:51:55.191Z","updated_at":"2025-03-24T03:30:58.031Z","avatar_url":"https://github.com/zerowidth.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gh-md: markdown link and issue reference generation\n\nThis [GitHub CLI](https://cli.github.com) extension generates markdown links from input URLs or references.\n\nThis isn't particularly useful by itself, but combine it with tools like [Alfred](https://alfred.app) snippet triggers, [Raycast](https://www.raycast.com) scripts, or [Obsidian](https://obsidian.md) templates, you can automate these links for insertion into your markdown documents.\n\n## Installation\n\n`gh extension install zerowidth/gh-md`\n\n## Usage\n\n`gh md --help` for full details.\n\n### `gh md link`\n\nGenerates a markdown link from an input URL or issue/pr/discussion reference.\n\nBasic example:\n\n```\n$ gh md link https://github.com/cli/cli/pull/123\n[cli/cli#123: Tweak flags language](https://github.com/cli/cli/pull/123)\n```\n\nSkip title lookup:\n\n```\n$ gh md link --simple https://github.com/cli/cli/pull/123\n[cli/cli#123](https://github.com/cli/cli/pull/123)\n```\n\nCreate a link from an issue reference:\n\n```\n$ gh md link cli/cli#123\n[cli/cli#123: Tweak flags language](https://github.com/cli/cli/pull/123)\n```\n\n### `gh md ref`\n\nGenerates an issue/pr/discussion reference from an input URL or reference.\n\n```\n$ gh md ref https://github.com/cli/cli/pull/123\ncli/cli#123\n```\n\n### `gh md title`\n\nLooks up the title of the given URL or reference:\n\n```\n$ gh md title cli/cli#123\nTweak flags language\n```\n\nThe title can be sanitized for use as a path, stripping `:`, `/`, and a few other characters.\n\n### `gh md url`\n\nGenerates the URL from the given issue reference or markdown link.\n\n```\n$ gh md url cli/cli#123\nhttps://github.com/cli/cli/pull/123\n```\n\n## Using `gh-md` in [Obsidian](https://obsidian.md)\n\n`gh-md` was built in part to be used in user-defined functions in the [Templater](https://github.com/SilentVoid13/Templater) plugin.\n\n### Markdown links\n\n- define a `markdownLink` user function as `/path/to/gh md link -n \"$input\"`\n- copy a GitHub URL to your clipboard\n- use it in a template: `\u003c% tp.user.markdownLink({input: (await tp.system.clipboard())}) %\u003e`\n\n### Sanitized titles\n\nThe sanitized issue title can be used for filenames. In a templater template for creating a document for an issue from the clipboard:\n\n- Define a `markdownTitle` user function as `/path/to/gh md title -n --sanitize \"$input\"`.\n- Use the title to rename a new file from that template:\n\n  ```\n  \u003c%- await tp.file.rename(\"Issue - \" + tp.date.now(\"YYYY-MM\") + \" - \" + (await tp.user.markdownTitle({input: (await tp.system.clipboard())}))) -%\u003e\n  ```\n\n### Auth issues\n\nIf you're using a recent version of the GitHub CLI that uses the system keychain to store credentials, these helper functions may not work. If so, you can configure the `PATH` in the user functions. This assumes you've installed the GH CLI with homebrew:\n\n- `PATH=$PATH:/opt/homebrew/bin /opt/homebrew/bin/gh md link -n \"$input\"`\n- `PATH=$PATH:/opt/homebrew/bin /opt/homebrew/bin/gh md title -n --sanitize \"$input\"`\n\n## Using `gh-md` with [Espanso](https://espanso.org)\n\nAn espanso config for generating links and references from the clipboard:\n\n```yaml\nmatches:\n  - trigger: \"//md\"\n    replace: \"{{output}}\"\n    vars:\n      - name: clipboard\n        type: clipboard\n      - name: output\n        type: shell\n        params:\n          cmd: \"gh md link {{clipboard}}\"\n  - trigger: \"//ml\"\n    replace: \"{{output}}\"\n    vars:\n      - name: clipboard\n        type: clipboard\n      - name: output\n        type: shell\n        params:\n          cmd: \"gh md link --simple {{clipboard}}\"\n  - trigger: \"//ir\"\n    replace: \"{{output}}\"\n    vars:\n      - name: clipboard\n        type: clipboard\n      - name: output\n        type: shell\n        params:\n          cmd: \"gh md ref {{clipboard}}\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Fgh-md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerowidth%2Fgh-md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Fgh-md/lists"}