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

Print the {html} operation in color #7

Open
gabebw opened this issue Sep 1, 2019 · 4 comments
Open

Print the {html} operation in color #7

gabebw opened this issue Sep 1, 2019 · 4 comments

Comments

@gabebw
Copy link
Owner

gabebw commented Sep 1, 2019

The Syntect crate looks like a good option: https://docs.rs/syntect/3.2.1/syntect/html/fn.highlighted_html_for_string.html

We don't need every feature, just the html feature: https://github.com/trishume/syntect#feature-flags

It looks like Syntect does not reformat (e.g adding indentation and newlines); it only adds syntax highlighting.

@gabebw
Copy link
Owner Author

gabebw commented Sep 1, 2019

Or a higher-level crate that's "bat as a library": https://crates.io/crates/prettyprint/0.2.0

@gabebw
Copy link
Owner Author

gabebw commented Sep 1, 2019

Hmmm, one issue would be if there's another operation besides {html}. Then it's a bit weird to have the HTML colored but the rest of it not colored. Or, maybe that's fine!

In any case, I'd like to have the HTML reformatted into a pretty indented tree no matter what: #8

@gabebw gabebw changed the title Pretty-print the {html} operation Print the {html} operation in color Sep 2, 2019
@gabebw
Copy link
Owner Author

gabebw commented Sep 2, 2019

People could also just pipe to bat:

curl ... | candle 'html {html}' | bat

@gabebw
Copy link
Owner Author

gabebw commented Sep 2, 2019

Although, Bat doesn't always detect HTML, so you need to do bat -l html.

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

No branches or pull requests

1 participant