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

TermRenderer Read/Write purpose #289

Open
calebstewart opened this issue Mar 16, 2024 · 2 comments
Open

TermRenderer Read/Write purpose #289

calebstewart opened this issue Mar 16, 2024 · 2 comments

Comments

@calebstewart
Copy link

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?

@maxmoehl
Copy link

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.

@nullswan
Copy link

I'd like to see this as well, have you been able to find any workaround?

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

3 participants