diff --git a/.changeset/old-maps-fold.md b/.changeset/old-maps-fold.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/old-maps-fold.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/apps/docs/README.md b/apps/docs/README.md index f7cbd7f83b6..fa97e16d3c4 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -8,6 +8,7 @@ - [Table of contents](#table-of-contents) - [Building](#building) - [Testing](#testing) + - [Referencing snippets](#referencing-snippets) ## Building @@ -42,3 +43,17 @@ If no environment is specified, it will run in the browser and node environments ```sh pnpm test ``` + +## Referencing snippets + +To reference a snippet outside of the current directory, you need to use the following syntax (`<<< @/`): + +```md +`<<< @/../../path/to/snippet.ts#snippet-name{language:line-numbers} +``` + +To reference a snippet in the current directory, you can use the following syntax (`<<< @./`): + +```md +`<<< @./snippets/transaction-request/fetch-resources.ts#transaction-request-5{ts:line-numbers} +``` diff --git a/apps/docs/src/guide/transactions/transaction-request.md b/apps/docs/src/guide/transactions/transaction-request.md index 95ceb4847bb..6d7b7337a82 100644 --- a/apps/docs/src/guide/transactions/transaction-request.md +++ b/apps/docs/src/guide/transactions/transaction-request.md @@ -60,7 +60,7 @@ If needed, you can manually include specific coins or messages in the transactio Imagine that you have a Sway script that manually calls a contract: -<<< @../../../../sway/script-call-contract/src/main.sw#transaction-request-7{rs:line-numbers} +<<< @/../../docs/sway/script-call-contract/src/main.sw#transaction-request-7{rs:line-numbers} In those cases, you will need to add both an `InputContract` and `OutputContract` to the transaction request: