Skip to content

Conversation

@Caesarsage
Copy link
Contributor

@Caesarsage Caesarsage commented Oct 19, 2025

Description

Adds an options parameter to the code_sample shortcode and forwards it to Hugo’s highlight function. This enables linenos, hl_lines, and other highlight features when including external files without changing existing calls.

follow-up PR will demonstrate usage #52837

Before:

{{% code_sample file="pods/resource/cpu-request-limit.yaml" %}}

After:

{{% code_sample file="pods/resource/cpu-request-limit.yaml" options="hl_lines=10-14" %}}

Preview

old:

image

new:

image

Closes: #

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language labels Oct 19, 2025
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/docs Categorizes an issue or PR as relevant to SIG Docs. labels Oct 19, 2025
@netlify
Copy link

netlify bot commented Oct 19, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 5b4cbe3
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/68f7438cb78ce90008ebf16f
😎 Deploy Preview https://deploy-preview-52795--kubernetes-io-main-staging.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 project configuration.

Copy link
Member

@lmktfy lmktfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR.

This should be 2 commits and ideally it wouldn't include commit fe845b0.

  • add the shortcode (first commit)
  • use the shortcode (second commit)

Alternatively, omit the second commit but show reviewers how they can test it out. A follow up PR can set highlighting options for some content.

@Caesarsage Caesarsage force-pushed the shortcode-add-highlight-options branch from fe845b0 to 4f3eca8 Compare October 21, 2025 08:10
@k8s-ci-robot k8s-ci-robot added the area/localization General issues or PRs related to localization label Oct 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sayakmukhopadhyay for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added language/zh Issues or PRs related to Chinese language size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 21, 2025
@Caesarsage Caesarsage force-pushed the shortcode-add-highlight-options branch from 4f3eca8 to 5b4cbe3 Compare October 21, 2025 08:25
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 21, 2025
@Caesarsage
Copy link
Contributor Author

Thank you for the PR.

This should be 2 commits and ideally it wouldn't include commit fe845b0.

  • add the shortcode (first commit)
  • use the shortcode (second commit)

Alternatively, omit the second commit but show reviewers how they can test it out. A follow up PR can set highlighting options for some content.

Thanks for the feedback. And added a follow up PR for reviewers to easily test.

@windsonsea
Copy link
Member

/remove-language zh
/remove-area localization

@k8s-ci-robot k8s-ci-robot removed language/zh Issues or PRs related to Chinese language area/localization General issues or PRs related to localization labels Oct 22, 2025
@Caesarsage
Copy link
Contributor Author

follow-up PR will demonstrate usage #52837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants