Mola-maker opened a new pull request, #74366:
URL: https://github.com/apache/airflow/pull/74366
## Why
The HITL (human-in-the-loop) approval form renders `hitlDetail.body` as
Markdown via `FlexibleForm`'s `flexFormDescription`. A single `\n` in the body
is a Markdown *soft break*, which collapses to a space when rendered — so
multi-line bodies (e.g. a dry-run result pushed through `{{ ti.xcom_pull(...)
}}`) display as one long line, even though the Rendered Template tab shows them
correctly.
This PR covers the **HITL body** part of #74018. The XCom tab part of the
same issue is already handled separately by #74112, so this uses `related:`
rather than `closes:`.
## What changed
- `src/components/ReactMarkdown.tsx`
- Callers can now pass extra `remarkPlugins`; they are merged with the
built-in `remark-gfm` instead of being silently overridden (previously a passed
`remarkPlugins` prop was discarded).
- Adds an exported, dependency-free remark plugin `remarkSoftBreaks` that
splits text nodes on single line breaks (`\n` / `\r\n`) into explicit `break`
nodes, which render as `<br />`.
- `src/components/FlexibleForm/FlexibleForm.tsx`
- Renders `flexFormDescription` with `remarkSoftBreaks` enabled.
`flexFormDescription` is only used for the HITL operator body, so Dag docs,
notes, param descriptions and all other Markdown rendering are unaffected and
keep the previous soft-break behavior.
- `src/components/ReactMarkdown.test.tsx`
- New tests: single line breaks render as `<br>` with the plugin enabled,
and keep collapsing to a space without it (default behavior unchanged).
## Verification
- `pnpm vitest run src/components/FlexibleForm
src/components/ReactMarkdown.test.tsx` — 7 files / 50 tests pass, including the
2 new tests.
- `tsc --p tsconfig.app.json` — clean.
related: #74018
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Kimi (Moonshot AI coding assistant), for implementation and
tests; changes reviewed locally with the UI test suite and type checker
Generated-by: Kimi (Moonshot AI) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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]