Skip to content
GitHub

FullSnippet

This component allows you to pull an entire file from a public Github repository to be displayed as code within a page.

It takes a source attribute which must be from the raw.githubsercontent.com API.

To use the component, the page must be in .mdx format. Change the format from .md to .mdx if necessary. All your existing markdown will still be supported without issue.

Usage

Import the FullSnippet component like so:

import FullSnippet from "/src/components/FullSnippet.astro";

Use the <FullSnippet> component within your content like so:

<FullSnippet source='https://raw.githubusercontent.com/interledger/open-payments-snippets/main/incoming-payment/incoming-payment-create.ts' />

Working example

There’s no working example at the moment.

This component was created to pull in GitHub files before the ChunkedSnippet component existed. ChunkedSnippet negated the need for us to use this component for our particular use case; however, it still exists and can be used as needed.