docs icon indicating copy to clipboard operation
docs copied to clipboard

feat: support for embedding code snippets

Open mdelapenya opened this issue 9 months ago β€’ 2 comments

Description

This pull request includes changes to the Dockerfile, documentation, and template files to support embedding code snippets from the testcontainers-go repository into the documentation. The most important changes include adding a new build stage to clone the testcontainers-go repository, updating the documentation to include an embedded code snippet, and modifying the shortcode template to handle these embedded snippets.

Dockerfile changes:

  • Added a new build stage git-src-oss to clone the testcontainers-go repository and copy it to the project directory ([DockerfileR36-R45](diffhunk://#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R36-R45)).

Documentation changes:

  • Updated content/manuals/testcontainers.md to include an embedded Go code snippet from the testcontainers-go repository ([content/manuals/testcontainers.mdR45-R46](diffhunk://#diff-7905b168f0bee5db6711b541f42c48f5d0901c8cdc17f323e3c1725a5445a3dcR45-R46)).

IMPORTANT: this change is a demonstration on how to use the embedding shortcode.

Template changes:

  • Created layouts/shortcodes/embedded.html to handle embedded code snippets, including logic to identify and extract specific code sections based on custom tags ([layouts/shortcodes/embedded.htmlR1-R65](diffhunk://#diff-dc256c151d3b9c325236dc0c38d0ef5155ce617bb93d44b669b7641a00fbe42aR1-R65)).

The tag is using the following format:

  • start tag: // START $id
  • end tag: // END $id

Exception: for testcontainers-go, where this mechanism already exists, we are using different start/end tags:

  • start tag: // $id {
  • end tag: // }

Reviews

  • [x] Technical review
  • [ ] Editorial review
  • [ ] Product review

mdelapenya avatar Mar 11 '25 10:03 mdelapenya

Deploy Preview for docsdocker ready!

Name Link
Latest commit ca0901bbb8c1230f0f04ff2f648a3a37cfc279bb
Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/67d0159f0a5c3c0008fa0c9b
Deploy Preview https://deploy-preview-22226--docsdocker.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 11 '25 10:03 netlify[bot]

Thanks for the pull request. We'd like to make our product docs better, but haven’t been able to review all the suggestions. As our docs have also diverged, we do not have the bandwidth to review and rebase old pull requests.

If the updates are still relevant, review our contribution guidelines and rebase your pull request against the latest version of the docs, then mark it as fresh with a /remove-lifecycle stale comment. If not, this pull request will be closed in 30 days. This helps our maintainers focus on the active pull requests.

Prevent pull requests from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Jun 17 '25 01:06 docker-robot[bot]