Skip to content

Wrap rendered code snippets and surface optional filenames - #2356

Merged
pelikhan merged 3 commits into
mainfrom
copilot/enable-pre-wrap-in-code-snippets
Jul 30, 2026
Merged

Wrap rendered code snippets and surface optional filenames#2356
pelikhan merged 3 commits into
mainfrom
copilot/enable-pre-wrap-in-code-snippets

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Long code lines in rendered workshop snippets were forcing horizontal scrolling, which made examples harder to read in-place. This change makes snippet bodies wrap by default and allows the existing custom snippet chrome to show a filename when the fence metadata provides one.

  • Rendering behavior

    • Apply pre-wrap and overflow-wrap: anywhere to rendered code blocks so long commands, YAML, and prompts stay readable without horizontal scrolling.
    • Preserve the existing snippet variants (terminal, prompt, markdown, yaml) and their copy-button behavior.
  • Snippet header metadata

    • Extend fenced-code parsing to read optional metadata after the language token.
    • Render a right-aligned filename in the snippet header when metadata includes a bare path or keyed value such as title=, file=, filename=, or path=.
  • UI updates

    • Add shared filename header styling across snippet chrome variants.
    • Keep header layouts resilient for long filenames by allowing truncation rather than expanding the block.
  • Regression coverage

    • Add targeted assertions for wrapped snippet CSS.
    • Add renderer coverage for filename extraction and header output.

Example:

```yaml .github/workflows/hello.yml
name: Hello
# Hello

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Wrap workshop code snippets and show optional filenames Wrap rendered code snippets and surface optional filenames Jul 30, 2026
Copilot AI requested a review from pelikhan July 30, 2026 11:02
@pelikhan

Copy link
Copy Markdown
Contributor

@copilot update guidelines.md with snippet filename support and ensure filenames that represent the file type are assigned and consistent accross pages.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update guidelines.md with snippet filename support and ensure filenames that represent the file type are assigned and consistent accross pages.

Addressed in 85b4342. I documented the filename-metadata convention in .github/workflows/guidelines.md and added consistent filename labels to the main workshop Markdown/YAML snippets so the rendered headers show file-appropriate names.

@pelikhan
pelikhan marked this pull request as ready for review July 30, 2026 11:12
@pelikhan

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved in 9e32406. I merged origin/main, resolved the conflict in scripts/lib/marked-setup.js, and kept both behaviors in the result: markdown snippets still use YAML-style highlighting and now retain the filename header support.

@pelikhan
pelikhan merged commit dabe44c into main Jul 30, 2026
4 checks passed
@pelikhan
pelikhan deleted the copilot/enable-pre-wrap-in-code-snippets branch July 30, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants