Zhnz commented on issue #74018: URL: https://github.com/apache/airflow/issues/74018#issuecomment-6195680408
I experimented some more and found out that the issue is with codeblocks in general. React-Markdown uses the CommonMark Syntax, where fenced codeblocks allow codeblocks to also be defined via three backticks or tildes, in addition to a 4-space indentation. The rendered result should wrap the content inside `<pre>` and `<code>` blocks according to the [spec](https://spec.commonmark.org/0.31.2/#fenced-code-blocks). I wrapped the multiline string in three backticks and the result is the same as with a 4-space indent: The code block formatting is applied, but the content formatting (the newlines) is gone. I inspected the rendered HTML elements and found out that the formatting is not kept, because the HTML output is missing the wrapping `<pre>` tags. The codeblock markdown is not rendered to HTML correctly. When I wrap the `<code>` block with `<pre>` tags, the result is shown correctly, at least in regards to keeping the newlines: <img width="760" height="356" alt="Image" src="https://github.com/user-attachments/assets/b9bdfc0d-41ae-4619-839f-76f4a1e1235a" /> This still looks kinda wrong when compared to the codeblock shown in the [HITL-Operator Tutorial](https://airflow.apache.org/docs/apache-airflow/stable/tutorial/hitl.html#approval-or-rejection) (see "Approval or Rejection" screenshot). There the whole codeblock is wrapped in a single block instead of a block for each line. @bbovenzi I propose the following procedure: - Close this issue - Close #74366 since it solves the problem wrong, by rendering the newlines by adding `<br>` tags, when the whole thing should be wrapped by `<pre>` tags. I don't think any additional logic should be added, when the issue seems to already come from additional logic added. React-Markdown should render the given Markdown code-block just fine. - Open a new issue specifically just for the markdown codeblock render problem - Open a new issue for mentioning markdown support inside the HITL-Operator tutorial -- 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]
