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

Render doc comment markdown in help commands #593

Open
1 of 4 tasks
david-crespo opened this issue Mar 12, 2024 · 0 comments
Open
1 of 4 tasks

Render doc comment markdown in help commands #593

david-crespo opened this issue Mar 12, 2024 · 0 comments
Labels
feature Issue for a new feature that does not break current functionality

Comments

@david-crespo
Copy link
Contributor

david-crespo commented Mar 12, 2024

Target component

  • CLI
  • SDK
  • Something else
  • Not sure

Overview

We support writing doc comments in markdown and we render said markdown beautifully on the docs site. When printed on the CLI, it is printed as plain text. It would be really snazzy and probably not very difficult to pipe that output through a simple markdown renderer.

Doc comment markdown rendered on the docs site image
oxide help completion output image

Implementation details

It doesn't look like Rust has a mature equivalent to the wonderful glow, but it looks like there are options, like termimad. On the other hand, if we want to use very popular libraries, the best way might be to use one crate that renders markdown to HTML, like markdown.rs or comrak, and then some other crate to render (or really just strip down) that HTML for the terminal.

The hard part here seems to be hooking into clap to process all help commands in a general way, including oxide help, oxide -h, oxide instance help list, etc. Something on this page of the clap docs will probably help.

@david-crespo david-crespo added the feature Issue for a new feature that does not break current functionality label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue for a new feature that does not break current functionality
Projects
None yet
Development

No branches or pull requests

1 participant