Add Snippets support to Github Files#832
Conversation
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
This reverts commit adc8613.
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
|
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
|
Hey @ntindle I'll take a look over the weekend and make sure that we support it, through this PR or another |
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
|
maybe fixes #446 |
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
| const embedBlock = createComponent< | ||
| { url?: string }, | ||
| { visible: boolean }, | ||
| { url?: string; visible?: boolean }, |
| }, | ||
| }); | ||
|
|
||
| const snippetBlock = createComponent< |
There was a problem hiding this comment.
adds a snippet block that takes in a URL and one or more snippet tag
| }, | ||
| }); | ||
|
|
||
| const simpleGithubBlock = createComponent< |
There was a problem hiding this comment.
Adds a block that lets you query by owner/repo/branch/file/snippets + supports multiple snippets
| **GitHub Snippet**: Insert the snippet block, provide a GitHub URL and a snippet tag (e.g., "BaseOAuthExample"), and the integration will extract and display only the code between the `--8<-- [start:tag]` and `--8<-- [end:tag]` markers. You can also add multiple snippets to combine them into a single code block. | ||
|
|
||
| **Simple GitHub Reference**: Insert the simple GitHub block and provide repository details (owner, repo, branch, file path) for an easier way to reference files without full URLs. |
There was a problem hiding this comment.
these could probably use some work on clarity
| const constructGithubUrl = (owner: string, repo: string, branch: string, filePath: string) => { | ||
| return `https://github.com/${owner}/${repo}/blob/${branch}/${filePath}`; | ||
| }; | ||
|
|
There was a problem hiding this comment.
technically this won't work for self hosted github enterprise server instances, not sure if that matters. If so, we can change the config to include a baseline root URL

We're looking at migrating over from mkdocs-material and one of the features we use heavily is
snippetsbased on https://facelessuser.github.io/pymdown-extensions/extensions/snippets/This brings over a simple version of that to cover our needs