3 ms·
Probably a little too off-topic, but after years of using similar "custom" methods of doing syntax highlighting, trying several WordPress plugins to automatical
by ComputerGuru 15y ago
Probably a little too off-topic, but after years of using similar "custom" methods of doing syntax highlighting, trying several WordPress plugins to automatically highlight, and several other options, I have found embedding GitHub Gists in blog posts to be the most reliable and lowest maintenance approach.
This probably won't matter to most people, but if you're the kind of person that has tutorials or examples or any other kind of thing you try to keep up to date in a blog post over the years, things like TOhtml make it hard to quickly edit and maintain the code, while WordPress plugins invariably do a poor job, add too much to the processing time (though you should be using a caching solution), and break on upgrade. For me, GitHub's Gists were a godsend.
- perlgeek 15y agoThe key is to store the original, and to display the tohtml output. I'm kinda skeptical about embedding stuff from external sites; the more external dependencies you have, the less reliable your own blog becomes.
- deleted 15y ago[deleted]
- olalonde 15y agoI guess he estimates that is is more likely for him to loose the original than for gist to shutdown.
- jlarocco 15y agoI had the same complaint and wrote a script to create static HTML from GitHub's Gists. I added the gist CSS rules to the rules for the WordPress theme I'm using, and now I can copy/paste the generated HTML into blog posts without fetching from GitHub. It requires Python3 and PyQt (to execute Javascript), so it's pretty heavy weight, but I have them installed anyway, so it's worked well for me. A brief explanation and the code is here: http://jlarocco.com/2011/12/22/static-gist-creator/ http://jlarocco.com/2011/12/22/static-gist-creator/ And just the code is here: https://gist.github.com/1513192 https://gist.github.com/1513192
- aidos 15y agoUnfortunately Gists aren't very viewable on a mobile (certainly on an iPhone) as they're truncated and there's no way to scroll to the right. A number of times I've been disappointed to find articles (The Zen of R that's on the front page at the moment, for example) that I can't read. There's a button to view in raw but it's a bit of a shame that I can't view the content with highlighting and proper (non)wrapping.
- apl 15y ago> (...) and there's no way to scroll to the right Just swipe using two fingers, and everything works as intended.
- aidos 15y agoOh wow. Thanks!
- dave1010uk 15y agoGists also don't show up in some (most?) RSS readers.