Live data from Hacker News

Show HN: Generate high-res images of code samples with Chrome Headless

github.com

31–40 of 92 posts

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#32

Anyone knows a tool which can help us draw simple diagrams like the one that was mentioned in the README?? https://github.com/mplewis/src2png/blob/master/docs/foreach_...

`mscgen` [1] was a popular one back in the day. I think `graphviz` can do it too. Since sequence diagrams are part of UML, most UML tools can do those.

[1] https://en.wikipedia.org/wiki/MscGen

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#33

What's wrong with pygments? I've been using it to get highlighted code as latex, html, whatever, since forever. I'm all for reinventing deficient wheels, but is there anything wrong with this? pygmentize -f png -l python -o test.png test.py Spinning up a browser for it seems like an odd choice. At least the author acknowledges that.

100% agreed.

Just fwiw, apparently (i.e., I discovered in the last 10 mins) pygmentize detects file extensions, so

    $ pygmentize -o test.png test.py 
is equivalent.

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#34
post #6

Nice work. But I'm not looking forward to trying to select text only to drag an image

Thanks! I built this for Keynote presentations specifically. I wanted to be able to write code samples as snippet files, then generate a batch of images I can drop into my presentations. If you're posting code on a website, you're right – you should prefer and prism.js or highlight.js :)

My first thought was publication ready pseudo code or code snippets for posters

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#36
post #27
post #14

Earlier quoted context omitted.

Yep – I can't copy my code out of Atom and keep its highlighting in Keynote, unfortunately.

Why not just do a screenshot of the code from Atom?

That doesn't scale well beyond doing a handful of them, I would think.

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#37

Anyone knows a tool which can help us draw simple diagrams like the one that was mentioned in the README?? https://github.com/mplewis/src2png/blob/master/docs/foreach_...

I tend to like https://www.draw.io/ for that sort of thing (there is a chrome app if you want to run offline).

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#38
post #13
post #9

Why "Show HN" but not publish to NPM? Seems neat, just publish it. Also, ever try this technique? https://gist.github.com/jimbojsb/1630790 I've used it with success before.

Thank you! I don't want to publish it yet because I want to clean it up a lot first – ditch the dev server, clean up the build pipeline, add some actual CLI arguments, etc. I'll check out that app on brew, it looks like a cool approach. Thanks!

Publish then iterate!

Re: Show HN: Generate high-res images of code samples with Chrome Headless

#40
post #19

If I want to scratch my left hear, I would use my left hand. Why in the world I'll do it with my right foot? What happened to the simple screenshot? This seems to be the flow: +----------+ +----------+ +-------------+ | | | | | | | NodeJS +------->+ POI +--------->+ Puppeteer +----+ | | | | | | | +----------+ +----------+ +-------------+ | | | +----------+ +----------+ +-------------+ | | | | | | | | | NodeJS * drawn…

The next step is to start a virtual machine to run NodeJS to "improve" on this workflow.

Nah, this is perfect for containers. You could use kubernetes to manage it all.
Post reply on HN