dheerajturaga opened a new pull request, #53657:
URL: https://github.com/apache/airflow/pull/53657

    This PR attempts to fix #50324
   
     The issue was caused by double JSON serialization in the frontend:
     1. Backend already serializes template field values to strings via 
serialize_template_field()
     2. Frontend was calling JSON.stringify() again on these 
already-stringified values
     3. This resulted in escaped quotes and poor formatting
   
   Core Fixes
   
     - Fixed double serialization: Replaced JSON.stringify(value) with proper 
type checking in RenderedTemplates.tsx:97
       - Use string values directly if already strings
       - Only JSON stringify non-string values (objects/arrays)
     - Added whitespace preservation: Replaced \<Code\> component with 
\<SyntaxHighlighter\> to preserve newlines and indentation
   
   Syntax Highlighting Enhancement
   
     - Integrated react-syntax-highlighter with automatic language detection:
       - JSON: Detects objects/arrays with valid JSON structure
       - YAML: Detects key-value pairs with colons and lists
       - SQL: Detects keywords like SELECT, INSERT, CREATE, etc.
       - Bash: Detects commands, shebangs, control structures, and operators
       - Text: Falls back to plain text for unrecognized content
     - Theme support: Respects dark/light mode themes consistent with DAG code 
viewer
     - Improved styling: Added proper spacing, border radius, and responsive 
alignment
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to