Skip to content

Conversation

@thrix
Copy link
Contributor

@thrix thrix commented Nov 19, 2025

Fix rendering of description field which has multiple lines.

Now it looks like this:

https://tmt.testing-farm.io/?test-url=https://gitlab.com/testing-farm/tests&test-name=/container/build

With these changes, it renders this way:

https://imgur.com/a/S5cRLOj

Generated-by: Claude Code

Resolves: #25

@codiumai-pr-agent-free
Copy link

This app will be decommissioned on Dec 1st. Please remove this app and install Qodo Git.

User description

Fix rendering of description field which has multiple lines.

Now it looks like this:

https://tmt.testing-farm.io/?test-url=https://gitlab.com/testing-farm/tests&test-name=/container/build

With these changes, it renders this way:

https://imgur.com/a/paPvSXZ

Generated-by: Claude Code noreply@claude.com


PR Type

Enhancement


Description

  • Improve multiline description rendering with proper formatting

  • Add CSS styling for description display with line breaks

  • Wrap descriptions in semantic HTML structure with <pre> tag

  • Add comprehensive test coverage for multiline description handling


Diagram Walkthrough

flowchart LR
  A["Multiline Description Text"] -->|"Wrapped in div.description"| B["Pre-formatted Text Block"]
  B -->|"CSS: white-space pre-wrap"| C["Preserved Line Breaks"]
  D["Template Updates"] -->|"Applied to"| E["testorplan.html.j2<br/>testandplan.html.j2"]
  F["Unit Tests"] -->|"Validate"| C
Loading

File Walkthrough

Relevant files
Enhancement
_base.html.j2
Add CSS styling for multiline descriptions                             

src/tmt_web/templates/_base.html.j2

  • Add .description class with margin styling
  • Add .description-text class with white-space: pre-wrap for line
    preservation
  • Style description block with blue left border and padding
  • Enable horizontal scrolling for long lines with overflow-x: auto
+21/-0   
testorplan.html.j2
Update description rendering with semantic HTML                   

src/tmt_web/templates/testorplan.html.j2

  • Replace inline description paragraph with semantic

    class="description"> wrapper
  • Move description label to separate paragraph element
  • Wrap description content in
     tag
  • Preserve multiline formatting in rendered output
+4/-1     
testandplan.html.j2
Refactor description rendering for both sections                 

src/tmt_web/templates/testandplan.html.j2

  • Update test section description rendering with new HTML structure
  • Update plan section description rendering with new HTML structure
  • Apply consistent formatting across both test and plan descriptions
  • Use
     tag to preserve line breaks in multiline content
+8/-2     
Tests
test_html_generator.py
Add test coverage for multiline descriptions                         

tests/unit/test_html_generator.py

  • Add new test test_multiline_description_rendering for multiline
    descriptions
  • Create test data with multiline description containing empty lines
  • Verify HTML structure includes
    and

    class="description-text">
  • Assert all description lines are preserved in rendered output
+44/-0   

The managed version of the open source project PR-Agent is sunsetting on the 1st December 2025. The commercial version of this project will remain available and free to use as a hosted service. Install Qodo.

@codiumai-pr-agent-free
Copy link

codiumai-pr-agent-free bot commented Nov 19, 2025

This app will be decommissioned on Dec 1st. Please remove this app and install Qodo Git.

PR Compliance Guide 🔍

(Compliance updated until commit 39ffd18)

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟢
🎫 #25
🟢 Render test descriptions as multiline strings instead of a single line
Display multiline descriptions in a more readable format
Preserve line breaks in descriptions
Make the description section visually distinct
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Previous compliance checks

Compliance check up to commit ea74ec2
Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

The managed version of the open source project PR-Agent is sunsetting on the 1st December 2025. The commercial version of this project will remain available and free to use as a hosted service. Install Qodo.

@thrix thrix requested review from psss and therazix November 19, 2025 09:23
@codiumai-pr-agent-free
Copy link

codiumai-pr-agent-free bot commented Nov 19, 2025

PR Code Suggestions ✨

This app will be decommissioned on Dec 1st. Please remove this app and install Qodo Git.

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Render description field as Markdown

The current use of a

 tag for the description only handles plain text. To align 
with the tmt specification that supports Markdown, a Markdown library and a
custom Jinja filter should be used to correctly render formatted content.

Examples:

src/tmt_web/templates/testorplan.html.j2 [14-17]
    <div class="description">
      <p><strong>Description:</strong></p>
      <pre class="description-text">{{ testorplan.description }}</pre>
    </div>
src/tmt_web/templates/testandplan.html.j2 [15-18]
    <div class="description">
      <p><strong>Description:</strong></p>
      <pre class="description-text">{{ test.description }}</pre>
    </div>

Solution Walkthrough:

Before:

{# In testorplan.html.j2 #}
{% if testorplan.description %}
  <div class="description">
    <p><strong>Description:</strong></p>
    <pre class="description-text">{{ testorplan.description }}</pre>
  </div>
{% endif %}

{# CSS in _base.html.j2 #}
.description-text {
    white-space: pre-wrap;
    ...
}

After:

# In Python code, add a markdown filter to Jinja
import markdown
def markdown_filter(text):
    return markdown.markdown(text)
jinja_env.filters['markdown'] = markdown_filter

{# In testorplan.html.j2, use the filter and 'safe' #}
{% if testorplan.description %}
  <div class="description">
    <p><strong>Description:</strong></p>
    <div class="description-text">
      {{ testorplan.description | markdown | safe }}
    </div>
  </div>
{% endif %}
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the PR's use of <pre> fails to render Markdown, which is supported by the tmt specification for the description field, thus addressing a significant functional gap.

Medium
Security
Explicitly escape description to prevent XSS

Add the escape filter to the test.description variable to explicitly sanitize
user-provided content and prevent potential Cross-Site Scripting (XSS)
vulnerabilities.

src/tmt_web/templates/testandplan.html.j2 [17]

-<pre class="description-text">{{ test.description }}</pre>
+<pre class="description-text">{{ test.description | escape }}</pre>
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: This is a valid and important security suggestion. Explicitly escaping user-provided content is a best practice to prevent XSS vulnerabilities, even if the framework provides auto-escaping.

Medium
  • Update

The managed version of the open source project PR-Agent is sunsetting on the 1st December 2025. The commercial version of this project will remain available and free to use as a hosted service. Install Qodo.

Fix rendering of description field which has multiple lines.

Now it looks like this:

https://tmt.testing-farm.io/?test-url=https://gitlab.com/testing-farm/tests&test-name=/container/build

With these changes, it renders this way:

https://imgur.com/a/S5cRLOj

Generated-by: Claude Code <noreply@claude.com>

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Copy link
Contributor

@therazix therazix left a comment

Choose a reason for hiding this comment

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

LGTM.

@thrix thrix merged commit 13a07d2 into main Nov 21, 2025
3 checks passed
@thrix thrix deleted the issue-25 branch November 21, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show multiline strings correctly in description

4 participants