Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Render markdown from stdin rather than tmpfile #13

Open
shazow opened this issue Aug 31, 2020 · 2 comments
Open

Render markdown from stdin rather than tmpfile #13

shazow opened this issue Aug 31, 2020 · 2 comments

Comments

@shazow
Copy link

shazow commented Aug 31, 2020

I noticed that there's a bunch of code dealing with creating/reading/cleaning up temporary files, but also that all of the markdown renderers support reading from stdin:

  • echo "foo" | glow -
  • echo "foo" | mdr
  • echo "foo" | mdcat

Would it be worth to simplify the code and generalize the parser command support to just take any command that reads from stdin?

@shazow
Copy link
Author

shazow commented Sep 5, 2020

I did some research on how to do this and turns out it's quite tricky, since there aren't good controls for disabling tty echo on stdin.

My rough one-liner for how I was trying to do it:

let bufid = bufnr('%') | new | let id = termopen('mdcat') | call chansend(id, getbufline(bufid, 1, '$') + ["\r", "\004"])

There's a neovim issue that got marked for the v0.5 release milestone that would allow this (neovim/neovim#9107), but I'm not sure about oldvim.

Feel free to close this issue if you agree that it's not feasible. :)

@skanehira
Copy link
Owner

Thank you for your proposed :)
I agree with your idea but I was try use stdin and it was doesn't works fined.
I'll try again 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants