-
Notifications
You must be signed in to change notification settings - Fork 334
Convert markdown to XML documentation syntax in C# emitter #9401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JoshLove-msft
merged 10 commits into
main
from
copilot/adopt-documentation-spector-scenarios
Jan 21, 2026
Merged
Convert markdown to XML documentation syntax in C# emitter #9401
JoshLove-msft
merged 10 commits into
main
from
copilot/adopt-documentation-spector-scenarios
Jan 21, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Adopt documentation spector scenarios
Add C# tests for Documentation spector scenarios
Jan 17, 2026
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot
AI
changed the title
Add C# tests for Documentation spector scenarios
Convert markdown to XML documentation syntax in C# emitter
Jan 17, 2026
jsquire
approved these changes
Jan 18, 2026
.../http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Statements/XmlDocStatement.cs
Outdated
Show resolved
Hide resolved
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Utilities/DocHelpers.cs
Outdated
Show resolved
Hide resolved
…terns Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
...-client-csharp/generator/TestProjects/Spector.Tests/Http/Documentation/DocumentationTests.cs
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
...ges/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Documentation/ListsTests.cs
Outdated
Show resolved
Hide resolved
...client-csharp/generator/TestProjects/Spector.Tests/Http/Documentation/TextFormattingTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
commit: |
Contributor
|
No changes needing a change description found. |
...p/generator/TestProjects/Spector/http/documentation/src/Generated/Models/BulletPointsEnum.cs
Show resolved
Hide resolved
jorgerangel-msft
approved these changes
Jan 21, 2026
jorgerangel-msft
approved these changes
Jan 21, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement markdown to XML doc conversion for C# documentation
Successfully implemented the missing functionality for Documentation spector scenarios. C# XML documentation doesn't support markdown syntax, so we now convert markdown to proper XML tags.
Complete Implementation:
DocHelpers.cs**bold**→<b>bold</b>*italic*→<i>italic</i>***bold italic***→<b><i>bold italic</i></b>- bullet→<list type="bullet">...1. numbered→<list type="number">...XmlDocStatement.csto preserve XML tags (not escape them)XmlDocStatement.csto use HashSet for allowed XML tagsDocHelpers.csto use static pre-compiled regex patternsDocumentationTests.csfileFiles Changed:
ConvertMarkdownToXml()with static pre-compiled regexSkipValidTag()using HashSet for maintainabilityTest Results:
✅ All 16 DocHelpers unit tests passing
✅ All 6 SpectorTests include reflection-based validation for both method and enum documentation
✅ Build succeeds without errors
✅ Generated documentation has proper XML tags
✅ XML tags are not escaped (no
<or>)The implementation is complete and ready for review!
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.