Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to Markdown #44

Closed
sharkdp opened this issue Mar 19, 2018 · 6 comments
Closed

Export to Markdown #44

sharkdp opened this issue Mar 19, 2018 · 6 comments

Comments

@sharkdp
Copy link
Owner

sharkdp commented Mar 19, 2018

Add a --export-markdown option in analogy to #41 for CSV and #42 for JSON.

The output could look like this:

| Benchmark | Mean [ms]   | Min. [ms] | Max. [ms] |
|-----------|-------------|-----------|-----------|
| command 1 | 205.1 ± 1.5 | 201.1     | 207.6     |
| command 2 | 403.5 ± 2.4 | 400.3     | 407.4     |

Rendered:

Command Mean [ms] Min. [ms] Max. [ms]
command 1 205.1 ± 1.5 201.1 207.6
command 2 403.5 ± 2.4 400.3 407.4
@stevepentland
Copy link
Contributor

I've started looking at this and it seems like we're going to implement this one by hand. There's been nothing I've seen that will do this form of serialization by default, and nothing in particular that will integrate with serde.

@sharkdp
Copy link
Owner Author

sharkdp commented Mar 19, 2018

Using something like https://docs.rs/comrak/0.2.8/comrak/ could work (create an AST that represents the table and pretty-print it via format_commonmark).

On the other hand, maybe the easiest option for now would be to simply write! the markdown table by hand. It doesn't necessarily have to look pretty in the source file.

@stevepentland
Copy link
Contributor

True, in our case simply creating the encoded values ourselves will probably be best as it is rather simple. I'll move into that next since #45 is now ready

@stevepentland
Copy link
Contributor

stevepentland commented Mar 19, 2018

@sharkdp I've completed this in my export-markdown branch. I'll make a PR once #45 has been merged.

Export result:

Benchmark Mean [ms] Min. [ms] Max. [ms]
ls -R ~ | echo "test" 4.1 ± 0.7 1.2 6.5
ls -alR | echo "TEST" 5.1 ± 0.9 3.2 11.2

@sharkdp
Copy link
Owner Author

sharkdp commented Mar 20, 2018

Looks great! Maybe we could add backticks ("`") around the command such that it would render as code?

@stevepentland
Copy link
Contributor

stevepentland commented Mar 20, 2018

Missed your comment, adding it now

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

No branches or pull requests

2 participants