joeyespo / grip

Preview GitHub README.md files locally before committing them.
MIT License
6.42k stars 423 forks source link

How to get rid of header with fake tab? #331

Open Boscop opened 3 years ago

Boscop commented 3 years ago

Thanks for making this useful tool :) I have a question: How can I get rid of this unnecessary header with the fake tab? (A pseudo tab inside the actual browser tab, which also wastes space at the top.)

image

cassamajor commented 3 years ago

That header is referred to as the title.

This is what I did using the CLI:

cat "/path/to/file" | grip - --export report.html

Taking it from stdin removes the title. Alternatively, if you are importing grip into a Python script, look at the documentation since it details the ability to set title to None.

Boscop commented 3 years ago

@Fauxsys Thanks! I don't use it from a python script, but from the cmd line.

Btw:

 --title=<title>   Manually sets the page's title.

I assumed it only sets the html page title in the html head, because that's what is usually meant by page title when it comes to html. When I don't pass --title, there is no fake tab either, and it defaults to the file name. But I just want to set the html head title, not add a fake tab. I think from a UX design perspective, --title should only set the title in the html head, and not add this fake tab. There should be a separate flag for that.

sas101 commented 3 years ago

Running grip like this: $ grip --title " " README.md removes the text, but still keeps the header with book icon, which works for me for now. But I'd also appreciate it, if the rendering of the title header with the book icon could be completely omitted.

P.S. Big Thanks from me too - grip is very useful! :+1:

firasm commented 3 years ago

Thanks @Fauxsys! Your solution works perfectly and gets rid of the header with the book icon.

There is still some empty space at the the top, but I'll live with that!

Screen Shot 2021-03-20 at 3 47 51 PM

FYI for anyone coming through, here is the exact command:

cat junior_developer.md | grip - --export junior_developer.html

(not sure why that extra - is needed, but if I don't have it, I get an API rate limit error).

This issue should probably be closed right @Boscop ?

If it would be helpful I can add this to the README in case others want to convert markdown to pdf without having the header at the top with grip!

Thanks again for Grip!

mtovmassian commented 2 years ago

Thank you @Fauxsys it works perfectly as expected.

Just for your information I integrated your command in a custom Bash script and shellcheck raise me the warning SC2002 'Useless Use Of Cat'. Indeed it's more efficient to use redirection like so:

grip - --export report.html < /path/to/file