TermRenderer Read/Write purpose
calebstewart opened this issue · 2 comments
It appears that the term renderer attempted to implement io.Reader
and io.Writer
interfaces with the Read()
and Write()
functions. However, they don't appear to do anything. They seem to proxy calls to read/write of two different bytes.Buffer
objects.
My expectation was that those functions were used to render a markdown file from an io.Reader
. So, I tried to do:
io.Copy(renderer, markdown_reader)
io.Copy(os.Stdout, renderer)
But this doesn't appear to work, and as mentioned above, after looking at the source code, those methods appear to do nothing. Is there some functionality I'm missing or are they in fact not functional?
I stumbled across this too, the feature is documented with the TermRenderer.Close
function:
Close must be called after writing to TermRenderer. You can then retrieve the rendered markdown by calling Read.
But it would be nice to have a way of streaming data through the renderer without having to load the entire document into memory.