Skip to content

Enable preformatting of job attempt logs#530

Open
jwarner112 wants to merge 1 commit intoriverqueue:masterfrom
jwarner112:jwarner/job-attempt-log-preformatting
Open

Enable preformatting of job attempt logs#530
jwarner112 wants to merge 1 commit intoriverqueue:masterfrom
jwarner112:jwarner/job-attempt-log-preformatting

Conversation

@jwarner112
Copy link

I recognize that it's ill-advised to use the metadata to store lots of logs. However, the logs I do provide, I'd like to have control over the output for. The <code> block in the PlaintextPanel prevents any attempts at pre-formatting.

In the backend, these logs are glommed together as a single []byte and that's fine, but upon output, that should make rendering the output of the TextHandler or JSONHandler easy; both of them separate records with newlines. With the use of a simple <code> tag, there's no way to perform any kind of formatting. It will strip it all.

This PR changes the PlainText component's <code></code> to a <pre><code></code></pre>, and I hope you'll consider approval.

I recognize that it's ill-advised to use the metadata to store lots of logs. However, the logs I do provide, I'd like to have control over the output for. The `<code>` block in the [PlaintextPanel][a] prevents any attempts at pre-formatting.

In the backend, these logs are glommed together as a single `[]byte` and that's fine, but upon output, that should make rendering the output of the `TextHandler` or `JSONHandler` easy; both of them separate records with newlines. With the use of a simple `<code>` tag, there's no way to perform any kind of formatting. It will strip it all.

This PR changes the PlainText component's `<code></code>` to a `<pre><code></code></pre>`, and I hope you'll consider approval.

[a]: https://github.com/riverqueue/riverui/blob/9df43c2f4f86cd726997ada749ac42e07be8b3f2/src/components/PlaintextPanel.tsx#L127-L129
@brandur
Copy link
Collaborator

brandur commented Mar 17, 2026

@bgentry Ugh, Blake I might have to kick this one over to you. I think it seems okay from a general HTML sense (it's common for the pre and code elements to be found together), but not sure if there'd be any gotchas to look out here given the expansive TS stack.

@jwarner112
Copy link
Author

Thanks for the reply! From my research, <code> was intended for one-liners and <pre><code> is what you want for multi-line snippets. In fact, the single-backtick inliner vs three-backtick code fence appears to be implemented in GitHub's own markdown previewer as <code> and <pre><code>, respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants