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

question: any suggestions for live markdown rendering? #63

Closed
devidw opened this issue Aug 21, 2024 · 4 comments
Closed

question: any suggestions for live markdown rendering? #63

devidw opened this issue Aug 21, 2024 · 4 comments

Comments

@devidw
Copy link

devidw commented Aug 21, 2024

tried glow and mdcat on macos but both don't seem to support streaming

@kardolus
Copy link
Owner

@devidw I haven't found anything that works for live markdown rendering. But this is a Go program that does markdown rendering: https://github.com/MichaelMure/go-term-markdown.

I was thinking of looking at the code. I am not sure how much work it would be to implement something like that into the CLI.

@devidw
Copy link
Author

devidw commented Aug 21, 2024

gotcha, ya i could not find anything either

for now i was able to hack something together by piping into this script, which uses glow and clears the output before each render: charmbracelet/glow#601 (comment)

@kardolus
Copy link
Owner

@devidw I finally did a deep dive into this :). I was inspired by that hack you shared and created a smoother script here:

https://github.com/kardolus/chatgpt-cli/blob/main/scripts/mdrender.sh

Clearing the console in a loop isn't great. My script doesn't do that. It's still a bit of a hack but it's smooth.

Try

chatgpt write a hello world program in Java | ./scripts/mdrender.sh

Let me know what you think!

@kardolus kardolus closed this as completed by moving to Done in LLM Kanban Oct 11, 2024
@kardolus
Copy link
Owner

Fun in combination with the new prompt flag too :)

cat README.md | chatgpt -n --prompt ../prompts/summarize.md | ./scripts/mdrender.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants