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

Add a delayed notification for reading Markdown from the stdin stream #644

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Feb 3, 2025

This PR adds a delayed notification for when Marp CLI is reading Markdown from the stdin stream.

[  INFO ] Currently waiting data from stdin stream. Conversion will start after
          finished reading. (Pass --no-stdin option if it was not intended)

Marp CLI supports stdin and stdout, similar to other UNIX tools. When stdin is open, Marp CLI waits for data to be fully received until the stream is closed.

However, users have frequently reported issues where the CLI appears to freeze due to an unclosed stdin stream. These problems are often caused by spawning the CLI process from the other language.

To make it easier to recognize when the CLI is reading from stdin, I have updated it to display a notification message via stderr.

This notification is delayed, so in simple use cases like the following, users may not notice the message:

$ echo slide.md | marp > slide.html
[  INFO ] Converting 1 markdown...
[  INFO ] <stdin> => <stdout>

If the stream is taking a while to read the stream (e.g. using curl to fetch the source through the network request), the notification message will appear after 3 seconds, like this:

$ curl -s --limit-rate 1k https://gist.githubusercontent.com/yhatt/a7d33a306a87ff634df7bb96aab058b5/raw/fbfaebfa469035306c38f87c108f73f6f837d6f5/marp.md | marp > slide.html
[  INFO ] Currently waiting data from stdin stream. Conversion will start after
          finished reading. (Pass --no-stdin option if it was not intended)
[  INFO ] Converting 1 markdown...
[  INFO ] <stdin> => <stdout>

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

Successfully merging this pull request may close these issues.

marp.exe rendering and watch mode do not work in msys on Windows 10 (i.e. git-bash)
1 participant