Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Tutorial documentation uses // highlight-start, // highlight-end, and // highlight-next-line comments to mark code changes between steps. These comments need to be converted to Expressive Code's native mark={} syntax.

Changes

  • Converted all highlight comments to mark={} syntax in tutorial documentation files

    • Removed // highlight-start / // highlight-end comment blocks and replaced with mark={start-end} ranges in code fences
    • Removed // highlight-next-line comments and replaced with individual line numbers in mark={}
    • Updated 7 tutorial files in getting-started/getting-started-rest/
  • Uses Expressive Code's native text-markers plugin with standard mark={} metadata syntax

Example Conversion

Before:

import "@typespec/http";

using Http;
// highlight-start
@service(#{
  title: "Pet Store",
})
// highlight-end

After:

import "@typespec/http";

using Http;
@service(#{
  title: "Pet Store",
})

The highlighting now works using Expressive Code's built-in functionality without requiring a custom plugin.

Files Updated

  • 01-setup-basic-syntax.mdx
  • 02-operations-responses.md
  • 03-handling-errors.md
  • 04-common-parameters.md
  • 05-authentication.md
  • 06-versioning.mdx
  • 07-custom-response-models.md
Original prompt

This section details on the original issue you should resolve

<issue_title>Highlight comments not working</issue_title>
<issue_description>Image

I believe they were supposed to show what was added in each code block but they seem broken now

https://expressive-code.com/key-features/text-markers/</issue_description>

<agent_instructions>check why those comments in the website docs are not working. They should be highlighting the lines to show what was added between tutorial steps</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 30, 2026 21:02
- Create custom plugin to handle // highlight-start, // highlight-end, and // highlight-next-line comments
- Plugin removes marker comments and applies text markers to highlighted lines
- Add plugin to Expressive Code configuration

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
- Remove debug logging
- Consolidate into two hooks: preprocessCode and preprocessMetadata
- Comments are successfully being removed from rendered code

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix highlight comments not working in documentation Add Expressive Code plugin for comment-based highlight markers Jan 30, 2026
Copilot AI requested a review from timotheeguerin January 30, 2026 21:10
Copy link
Member

Choose a reason for hiding this comment

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

@copilot lets not make a new plugin, can you find equivalent from expressive-code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've searched for equivalent functionality in Expressive Code and Starlight, but couldn't find a built-in plugin that supports // highlight-start / // highlight-end comment syntax.

Expressive Code's text-markers plugin only supports:

  • Meta-based syntax: ```tsp mark={4-6}
  • Regex-based inline highlighting

Would you like me to:

  1. Convert the documentation to use the standard mark={line-numbers} syntax in code fences?
  2. Or is there a specific Expressive Code plugin/configuration I should be using that I haven't found?

Copy link
Member

Choose a reason for hiding this comment

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

use mark

Copy link
Member

Choose a reason for hiding this comment

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

@copilot use mark

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Converted all highlight comments to use mark={} syntax. The custom plugin has been removed and all documentation files now use Expressive Code's native text-markers plugin.

Example: // highlight-start comments are now mark={4-7} in the code fence.

Changes in commit 7f31e0a.

- Remove custom comment-highlights plugin
- Convert // highlight-start, // highlight-end, and // highlight-next-line comments to mark={} syntax in code fences
- Update all tutorial documentation files in getting-started/getting-started-rest
- Use Expressive Code's native text-markers plugin with mark={} meta syntax

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the meta:website TypeSpec.io updates label Jan 30, 2026
Copy link
Contributor Author

Copilot AI commented Jan 30, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh -c ebsite/src/content/docs/docs/emitters/openapi3/reference node de --enable-experimsh gen-extern-signa-c /node_modules/.btspd doc . --enable-experimental --output-dir ../../website/src/content/docs/d--output-dir sh pec/�� lmstxt --output-dir ../../website/src/content/docs/docs/libraries/http/reference node bin/node /library-linter sh . st/node-gyp-bin/tsx ./.scripts/regen-compiler-docs.ts node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add Expressive Code plugin for comment-based highlight markers Convert highlight comments to Expressive Code mark syntax Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Highlight comments not working

2 participants