rq icon indicating copy to clipboard operation
rq copied to clipboard

Add HJSON color output

Open dflemstr opened this issue 9 years ago • 4 comments

Currently, there's no color output support for HJSON. It could hopefully share some coloring infrastructure with the JSON sink.

dflemstr avatar Aug 20 '16 14:08 dflemstr

Cool project 👍 If it's any help to you there are new editor syntax definitions on http://hjson.org/download.html#ed and (since you are already using js) hjson-js now has a color option.

laktak avatar Aug 31 '16 17:08 laktak

Looks like I could re-use some concepts from your link, but I'd like to match the color support of the JSON module if possible, like in this screenshot:

json highlighting

I think it would mostly involve changing the existing HJSON Rust library (https://github.com/hjson/hjson-rust), most likely.

dflemstr avatar Sep 01 '16 02:09 dflemstr

The colors aren't hardcoded though I haven't added an API yet.

Adding colors to hjson-rust should not be a problem either. They could be implemented in a new formatter (see HjsonFormatter)

laktak avatar Sep 01 '16 21:09 laktak

@laktak oh I didn't realize you're the author of that library... Makes sense!

I changed the formatter in serde_json version 0.9.0 (not yet released), see here: https://github.com/serde-rs/json/blob/v0.9.0/json/src/ser.rs#L803

I think the hjson-rust formatter would need to have a similar interface for me to be able to implement color support.

dflemstr avatar Sep 03 '16 17:09 dflemstr