Roger-luo / Configurations.jl

Options & Configurations made easy.
https://configurations.rogerluo.dev/stable
MIT License
80 stars 12 forks source link

Extra characters when printing in Pluto.jl #18

Closed chenspc closed 3 years ago

chenspc commented 3 years ago

I was trying to using Configurations.jl in Pluto.jl. When making an option type object, the printing shows extract characters. Not sure if this is an issue more suitable here or in Pluto.jl..

extra_characters
Roger-luo commented 3 years ago

haha, this is because Pluto doesn't support ASCII color characters - would be nice if Pluto supports it. I'm not sure what's the right way to disable it, it's probably a question for Pluto.

Roger-luo commented 3 years ago

@fonsp I'm wondering if there is a way to let the default HTML printing fallback to Pluto?

I guess we can assume that Configurations.jl would replace the previous option types defined manually inside Pluto, so some special handling based on is_option method is possible.


I think I'd just want the printing of option types defined by Configurations to be the same as how Pluto visualize normal Julia types, but it seems Pluto will not use the builtin method if Base.show is overloaded.

fonsp commented 3 years ago

I'll look into this!

Roger-luo commented 3 years ago

@fonsp I found a solution to this: https://juliadocs.github.io/ANSIColoredPrinters.jl/dev/

this allows me to replace the ASCII color escape characters with HTML class, but then I will need to use some CSS to visualize it for Pluto. Wondering what would be the best HTML output for Pluto? or should I use a different MIME type other than text/html

Roger-luo commented 3 years ago

current since Pluto doesn't have a CSS definition of ASCII types, you would get the following with this method

image

but I still prefer the default Pluto visualization...