Skip to content

feat: add Markdown formatting support for step content in test plans#1402

Merged
danhellem merged 5 commits into
mainfrom
users/danhellem/test-plans-1
Jul 8, 2026
Merged

feat: add Markdown formatting support for step content in test plans#1402
danhellem merged 5 commits into
mainfrom
users/danhellem/test-plans-1

Conversation

@danhellem

Copy link
Copy Markdown
Collaborator

This pull request enhances the formatting of test case steps in Azure DevOps by supporting Markdown-to-HTML conversion and ensuring proper XML-escaping for safe storage. It introduces a new helper function to handle the formatting and updates both the implementation and tests to verify correct behavior for various Markdown features and HTML escaping.

Formatting and Conversion Enhancements:

  • Added formatStepContent function in src/tools/test-plans.ts to convert Markdown markers (bold, italic, inline code, and links) to corresponding HTML tags, wrap the result in the ADO rich text envelope, and XML-escape the final string for storage.
  • Updated convertStepsToXml to use formatStepContent for both step and expected result content, ensuring all step content is consistently formatted and escaped.

Testing Improvements:

  • Added comprehensive tests in test/src/tools/test-plan.test.ts to verify that:
    • HTML tags in step content are properly XML-escaped.
    • Markdown bold and italic are converted to XML-escaped HTML.
    • Markdown inline code is converted to XML-escaped <CODE> tags.
    • Non-whitelisted HTML tags (e.g., <script>) are escaped and not rendered.
    • Markdown links are converted to XML-escaped anchor tags.

GitHub issue number

#1399 1398

Associated Risks

N/A

PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative.
  • 👌 Code hygiene
  • 🔭 Telemetry added, updated, or N/A
  • 📄 Documentation added, updated, or N/A
  • 🛡️ Automated tests added, or N/A

🧪 How did you test it?

Updated tests and tested manually with success

@danhellem danhellem requested a review from a team as a code owner July 6, 2026 13:47
@danhellem danhellem linked an issue Jul 6, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Comment thread src/tools/test-plans.ts Outdated
@danhellem danhellem enabled auto-merge (squash) July 7, 2026 13:37

@aaudzei aaudzei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved with suggestion

Comment thread src/tools/test-plans.ts
function formatStepContent(text: string): string {
// Convert Markdown markers to HTML tags (** before * and __ before _ to avoid conflicts)
const htmlContent = text
.replace(/\*\*(.+?)\*\*/g, "<B>$1</B>")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unless there is a specific reason to use uppercase HTML tags I'd prefer more conventional <b>Text</b>

@danhellem danhellem merged commit 87d5f68 into main Jul 8, 2026
7 checks passed
@danhellem danhellem deleted the users/danhellem/test-plans-1 branch July 8, 2026 11:51
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.

Add support for text formatting of test case steps

3 participants