Closed dmbates closed 2 years ago
Is there a relatively simple way of setting
:compact = true
on the IO stream where these values are interpolated?
I'm not so sure. It would be possible by overriding the appropriate Books.convert_output
method.
Another solution, without overriding Books.convert_output
, would be to define something like
r1(x) = round(parse(Float64, x); digits=1)
export r1
in the main module of the book, and to call this function via the post
keyword argument:
```jl
s = "1 + 1.234"
sco(s; post=output_block ∘ r1)
```
Which shows as
in the HTML output.
Thanks for the suggestions.
I would like to be able to interpolate the value of a variable into the text using the backtick
jl
construction but with the compact display for floating point values.The display defaults to the non-compact representation which produces more digits than I want. Is there a relatively simple way of setting
:compact = true
on the IO stream where these values are interpolated?