Skip to content

Fix multiline command names in Markdown exports - #1000

Closed
MokiMeow wants to merge 1 commit into
sharkdp:masterfrom
MokiMeow:fix/markdown-multiline-command
Closed

MokiMeow wants to merge 1 commit into
sharkdp:masterfrom
MokiMeow:fix/markdown-multiline-command

Conversation

@MokiMeow

@MokiMeow MokiMeow commented Oct 9, 2026

Copy link
Copy Markdown

A command name containing a line break creates extra rows in --export-markdown output. A blank line can end the table and separate the command from its timing. For example:

hyperfine --export-markdown results.md --command-name "first line
second line" 'sleep 1'

Normalize CRLF, CR and LF to spaces before formatting the Markdown code span. This keeps each result on one table row and follows CommonMark's code-span normalization. Existing backtick delimiters and escaped pipes are preserved.

Validation:

  • Eight formatter cases and a complete CLI snapshot, including backticks, pipes and blank lines; both new test functions fail before the fix.
  • Full tests: 128 passed on Windows/Rust 1.99; 134 passed on Linux/Rust 1.99 and the minimum supported Rust 1.97.0.
  • cargo fmt -- --check and cargo +1.97.0 clippy --locked --all-targets pass.
  • Independently rendered real CLI output with a CommonMark/table parser: the fixed output has one body row, four data cells and the complete command text.

@MokiMeow

MokiMeow commented Oct 9, 2026

Copy link
Copy Markdown
Author

Withdrawing this contribution to align with the project contribution policy. Thank you for your time.

@MokiMeow MokiMeow closed this Oct 9, 2026
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.

1 participant