Refactor markdown formatting utilities to avoid building intermediate strings (#29511)

These were nearly always used when using `format!` / `write!` etc, so it
makes sense to not have an intermediate `String`.

Release Notes:

- N/A
609c528cebMichael Sloan committed on 4/27/2025, 7:04:51 PM· committed by GitHubparent6db974d
19 files changedLine totals unavailable