Sarah4908 commented on PR #63492:
URL: https://github.com/apache/airflow/pull/63492#issuecomment-4186703122

   Hi @pierrejeambrun and @bbovenzi.Thanks for the feedback! I've updated the 
PR with a more complete fix after digging deeper into the root cause.
   
   **Root cause:**
   When a field is truncated, `truncate_rendered_value()` returns a Python 
string representation of the original value, where newlines are escaped as 
literal `\n`. The original frontend code passed this string directly to 
`SyntaxHighlighter` without converting those escaped characters back into real 
newlines — so everything rendered on a single line.
   
   **What changed in this update:**
   1. Unescape `\n` characters before rendering so line breaks are preserved: 
`value.split("\\n").join("\n")`
   2. Use `JSON.stringify(value, null, 2)` for non-string values so JSON 
objects are pretty-printed with indentation
   3. Removed `as="pre"` from the outer Box , it was conflicting with 
`SyntaxHighlighter`'s own whitespace handling
   4. Changed `PreTag="div"` to `PreTag="pre"` so whitespace is properly 
preserved inside the highlighter
   
   I've attached before and after screenshots showing the difference with a 
truncated field.
   <img width="1868" height="837" alt="before" 
src="https://github.com/user-attachments/assets/a3f39584-beed-4cab-8aa2-410029ad5a4b";
 />
   <img width="1907" height="832" alt="after" 
src="https://github.com/user-attachments/assets/d0247f11-1086-4777-ba14-82c98049bc9a";
 />
   Please let me know if you have any questions!


-- 
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