%% generate tags start %% #obsidian %% generate tags end %% #obsidian/plugin > [!info] This might be the first step of obsidian github integration %% run start ```ts const {LinkPreview} = customJS return LinkPreview.getLinkPreviewFromUrl("https://github.com/MrGVSV/obsidian-github-embeds") ``` %% <div class="nifty-link-card-container"> <a class="nifty-link-card" href="https://github.com/MrGVSV/obsidian-github-embeds" target="_blank"> <div class="nifty-link-card-text"> <div class="nifty-link-card-title line-clamp-2">GitHub - MrGVSV/obsidian-github-embeds: Embed GitHub issues, PRs, and code snippets directly in Obsidian</div> <div class="nifty-link-card-description">Embed GitHub issues, PRs, and code snippets directly in Obsidian - GitHub - MrGVSV/obsidian-github-embeds: Embed GitHub issues, PRs, and code snippets directly in Obsidian</div> <div class="nifty-link-href"> <img class="nifty-link-icon" src="https://github.com/fluidicon.png"> https://github.com/MrGVSV/obsidian-github-embeds </div> </div> <div class="nifty-link-image-container"> <div class="nifty-link-image" style="background-image: url('https://repository-images.githubusercontent.com/675192776/897ceaec-05fc-45a2-8492-6813bc040c27')"> </div> </div> </a> </div> %% run end %% ## Obsidian GitHub Embeds _Embed GitHub issues, PRs, and code snippets directly in Obsidian._ [![Demo GIF](https://github.com/MrGVSV/obsidian-github-embeds/raw/main/screenshots/github-embeds-demo.gif)](https://github.com/MrGVSV/obsidian-github-embeds/blob/main/screenshots/github-embeds-demo.gif) ## Details When in **reader mode**, the Github Embeds plugin will find all GitHub links and attempt to embed a preview below it. ### Issues and PRs Issues and pull requests will be displayed for any link matching one of the following: - `https://github.com/<OWNER>/<REPO>/issues/<ISSUE NUMBER>` - `https://github.com/<OWNER>/<REPO>/pull/<PR NUMBER>` ### File Snippets File snippets will be displayed when the link matches a URL like: - `https://github.com/<OWNER>/<REPO>/blob/<REF>/<PATH TO FILE>` Snippets can also be limited to one or more lines. If we wanted a file to only show line 12, we could append our URL with `#L12`. To show multiple lines, like 12 through 19, we could change this to read `#L12-L19`. > **Note** While we can scope our files to a particular set of lines, the entire file will still need to be requested. This may result in poor performance for really large files. ### Authentication In order to make use of GitHub's API, calls need to be authenticated. Because of that, this plugin requires you to [create a personal access token](https://github.com/settings/tokens?type=beta). By default, the token will be generated with the **Repository access** set to **Public repositories (read-only)**. To allow this plugin to also work with private repositories, change the access to **All repositories** and give it at minimum the following repository permissions: - **Contents** (_Read-only_) - **Issues** (_Read-only_) - **Pull requests** (_Read-only_) With the token created, navigate to this plugin's settings and paste it into the token text field. ## Screenshots [![Screenshot of pull request embed](https://github.com/MrGVSV/obsidian-github-embeds/raw/main/screenshots/pr-screenshot.png)](https://github.com/MrGVSV/obsidian-github-embeds/blob/main/screenshots/pr-screenshot.png)[![Screenshot of file embed](https://github.com/MrGVSV/obsidian-github-embeds/raw/main/screenshots/file-screenshot.png)](https://github.com/MrGVSV/obsidian-github-embeds/blob/main/screenshots/file-screenshot.png)