📚 docs: Add query docs and sample images

More docs more power.
This commit is contained in:
Nathan Smith 2024-02-01 23:27:38 -05:00
parent 25b5b799df
commit ff2f2f34ef
3 changed files with 47 additions and 1 deletions

View file

@ -2,10 +2,56 @@
**Obsidian + GitHub ❤️**
Transform boring GitHub links in notes into badges with rich content from GitHub's API.
Transform boring GitHub links in notes into tags with rich content from GitHub's API.
## Use
### Links
Github links are automatically transformed into tags. For example, pasting `https://github.com/nathonius/obsidian-github-link/issues/1` into a note will become:
![ExampleTag](doc/ExampleInlineTag.png)
### Table
You can also include a table with results from a search query using a `github-query` codeblock. For example:
````
```github-query
outputType: table
queryType: pull-request
query: "is:pr repo:nathonius/obsidian-github-link"
columns: [number, title, author, status]
```
````
This produces a table of results that refreshes upon opening the note.
![ExampleTable](doc/ExampleQueryResult.png)
The codeblock must be valid YAML. The following options are currently supported:
| Option | Values | Description |
| ------------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `outputType` | `table` | Required. Only table is currently supported. |
| `queryType` | `pull-request` | Required. Only pull requests are currently supported. |
| `query` | A valid GitHub search query. | Required. See the [GitHub docs](https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests) for more information. |
| `columns` | See list below. | Required. Should be an array of values. |
#### Supported Columns
Any column not listed below can still be used if it is included in the API response. Nested values can be used by giving the json object notation string to reference the value. For example, `user.login` will get the raw value of the username from the API query response.
| Column | Types | Description |
| ------------------------------ | -------------- | -------------------------------------------------------------- |
| `number` | `pull-request` | The PR number and a link to the PR. |
| `repo` | `pull-request` | A link to the repository. |
| `author` | `pull-request` | The user who created the PR along with a small avatar. |
| `status` | `pull-request` | The current status of the pull request. |
| `created`, `updated`, `closed` | `pull-request` | Formatted versions of the create, last update, and close date. |
## Setup
For public repositories, no extra configuration is required. For private repos, you'll need to log in through GitHub.
### Authentication

BIN
doc/ExampleInlineTag.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
doc/ExampleQueryResult.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB