simonhaenisch / md-to-pdf

Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
https://www.npmjs.com/md-to-pdf
MIT License
1.16k stars 111 forks source link

Do not emit process title to stdout #179

Closed ltvolks closed 1 year ago

ltvolks commented 1 year ago

Redirecting stdout into a target file is a common cli operation.

cat file.md | md-to-pdf > path/to/output.pdf

When the cli sets the process title, the helper util emits to stdout, which prepends a few bytes before the standard %PDF-#.# comment in the final PDF:

<0x1b>]0;md-to-pdf<0x07>%PDF-1.4

Most readers seem to ignore these bytes, but it's common for some tools to read a few bytes to determine if a file is a PDF.

Omitting the title seems like a sane strategy as I don't think it serves any useful purpose beyond cosmetic.

simonhaenisch commented 1 year ago

@ltvolks do you have time to make the change? Otherwise I can try to do it with a Codespace on your fork but I'm not sure I'll be able to commit there (i think if you ticked the "allow edits from maintainers" I can)?

ltvolks commented 1 year ago

Updated per request, thanks for considering this change.