ChunkedSnippet
This component allows you to display specially formatted code snippet files from a public GitHub repo within a page.
The snippet files must have “chunking comments” for the component to work correctly. Example.
The component takes a source
attribute which must be a raw Github link, and a chunk
attribute which specifies the chunk you want to display on-page.
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 ChunkedSnippet
component like so:
Use the <ChunkedSnippet>
component within your content like so:
Working example
Refer to the TypeScript code snippets within the Open Payments documentation for Get wallet address information. The raw source file is located here.