Changes in syntax highlighting and inserting code snippets

20 views
Skip to first unread message

Tamás Szelei

unread,
Mar 5, 2014, 8:45:00 AM3/5/14
to altdev...@googlegroups.com
Hello all,

Harriet asked me to send a quick note about the syntax highlighting changes. As you might have noticed, there has been some problems with syntax highlighting lately. After some discussion, we came up with the following solution:

The recommended way of inserting highlighted code snippets in your articles from now on is via GitHub Gists. If you are not familiar with them, Gists are much like an embedded YouTube video, except for source code. The process of inserting a code snippet in your articles is the following:

1. Go to https://gist.github.com/
2. Create and save a gist.
3. Copy the numeric gist id and insert the shortcode [gist id="number here"] in the post. A formatted code block will appear.

Example:

Inline image 1


To insert this gist, the code is [gist id="9366176"]
You can see what it looks like here: http://www.altdevblogaday.com/?p=31103&shareadraft=baba31103_531713e68ca20

The following plugin is used for the shortcode: http://wordpress.org/plugins/gist-github-shortcode/

The main advantage is that your code is not affected by the HTML filtering in wordpress, but the filtering still secures the site.
Of course, this solution does have some drawbacks (e.g. too many iframes might slow down page load).
If that is a substantial problem for some articles, the old plugin is still in place and can be used with admin help I suppose (to avoid filtering).

Regards,
Tamás

Alex 'darbotron' Darby

unread,
Mar 5, 2014, 11:06:06 AM3/5/14
to altdev...@googlegroups.com
Thanks for sharing Tamas :)

It's nice to have a formally documented work-around.

That said, I'd like to second Adam's comment on the previous thread re: getting the proper syntax highlighting solution working...

I've not posted in approx. a year because I've been waiting for the syntax highlighting to get fixed; whilst the workaround is welcome it's still way more hassle than having a working plugin.

I appreciate that this is being addressed, but just adding my tuppenceworth :)

Alex

Shawn Kirsch

unread,
Mar 5, 2014, 11:27:08 AM3/5/14
to altdev...@googlegroups.com
Looks great, but the font is huge! lol



--
You received this message because you are subscribed to the Google Groups "AltDevAuthors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altdevauthor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

Tamás Szelei

unread,
Mar 5, 2014, 3:46:08 PM3/5/14
to altdev...@googlegroups.com
That's a different problem. The font is huge on the whole site. Some script runs after page load that does this.
Üdvözlettel,
Szelei Tamás

Tamás Szelei

unread,
Mar 5, 2014, 3:52:58 PM3/5/14
to altdev...@googlegroups.com
On Wed, Mar 5, 2014 at 5:06 PM, Alex 'darbotron' Darby <darb...@darbotron.com> wrote:
Thanks for sharing Tamas :)

It's nice to have a formally documented work-around.

That said, I'd like to second Adam's comment on the previous thread re: getting the proper syntax highlighting solution working...

It is actually a harder problem than I first thought. See, it is not only a matter of enabling the right plugin (especially in the sad, sad world of wordpress plugins, where everything conflicts with everything, and even without a conflict you can only pray to have something work for the first time). The problem is with the aggressive HTML filtering in wordpress. std::vector<int> will become std::vector after filtering. Escaping with entities is still a hassle.
And for the record, I tried several plugins but none of them worked. I'm blaming the theme, but I'm not sure, there are many plugins in this installation. It might be possible to hack it somehow, but I think at this point it's wiser to focus on the new site, there is finite list of CSS issues only.

Regards,
Tamás

Adam Martin

unread,
Mar 5, 2014, 4:00:07 PM3/5/14
to altdev...@googlegroups.com
With wordpress its always the same:

0. Upgrade all plugins to their latest versions.
1. Disable all plugins (takes a minute)
2. If still brokenz: get a new theme, one that doesnt suck
3. Reenable the most critical plugjns one by one until one breaks it.
4. Repalce that with a similar plugin that doesnt suck.

This is why enabling is a one-click operation in the admin panel - it has to be quick.

You have to do this every couple of years on a WP site, or more frequently if you add a lot of random plugins.

Usually, if a plugin is broken, it means everyone else has got annoyed with it too and jumped ship to an alternative. You simply Jump with them :)
--

Hubert Rutkowski

unread,
Mar 15, 2014, 5:14:35 PM3/15/14
to altdev...@googlegroups.com


Have you tried SyntaxHighlighter Evolved ? I have it on my WP 3.8.1 blog (with a couple other plugins) and it works just fine.

Also, I'd like to point out that either I've done something wrong, or the gist plugin is broken (see attachement). The gist looks normal: https://gist.github.com/Koshmaar/9573883

Hubert

PS just as Alex, I was also waiting since january for the fix, to be able to post, and today thought "in middle of march this issue should be settled", checked and... :(
gist.png

Tamás Szelei

unread,
Mar 15, 2014, 6:05:58 PM3/15/14
to altdev...@googlegroups.com
On Sat, Mar 15, 2014 at 10:14 PM, Hubert Rutkowski <koshmaar...@gmail.com> wrote:


Have you tried SyntaxHighlighter Evolved ? I have it on my WP 3.8.1 blog (with a couple other plugins) and it works just fine.

It seems like something prohibits plugins from pulling in their JS
 

Also, I'd like to point out that either I've done something wrong, or the gist plugin is broken (see attachement). The gist looks normal: https://gist.github.com/Koshmaar/9573883

If you mean that there is no highlighting, that is because you selected plain text as the language. 
 
T.



Hubert

PS just as Alex, I was also waiting since january for the fix, to be able to post, and today thought "in middle of march this issue should be settled", checked and... :(


W dniu środa, 5 marca 2014 22:00:07 UTC+1 użytkownik Adam Martin napisał:
With wordpress its always the same:

0. Upgrade all plugins to their latest versions.
1. Disable all plugins (takes a minute)
2. If still brokenz: get a new theme, one that doesnt suck
3. Reenable the most critical plugjns one by one until one breaks it.
4. Repalce that with a similar plugin that doesnt suck.

This is why enabling is a one-click operation in the admin panel - it has to be quick.

You have to do this every couple of years on a WP site, or more frequently if you add a lot of random plugins.

Usually, if a plugin is broken, it means everyone else has got annoyed with it too and jumped ship to an alternative. You simply Jump with them :)


--
You received this message because you are subscribed to the Google Groups "AltDevAuthors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altdevauthor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joseph Simons

unread,
Apr 29, 2014, 11:33:34 PM4/29/14
to altdev...@googlegroups.com
I'm a bit confused. Do we have a solution in place for posting code or not? I am hoping to have a bit of code up for my next few posts and I am not having any real luck with the site currently as-is.
-Joseph-

Tamás Szelei

unread,
Apr 30, 2014, 3:04:30 AM4/30/14
to altdev...@googlegroups.com
Yes, we do, see my first email in the thread. I also removed the call to the script that switches to mobile view on desktop (that resulted in huge fonts and a stretched layout - you might need to empty your cache to see the difference). On the new site (altdev.co) I'm waiting to get file access. Harriet is on a leave and no one else answered, unfortunately.

Üdvözlettel,
Szelei Tamás

Giulia Palmieri

unread,
Apr 30, 2014, 4:53:10 AM4/30/14
to altdev...@googlegroups.com
HI there,
how can I help on that matter? Harriet is on maternity leave, but I take care of her tasks while she's away. So please let me know what you need in order to advance (I don't want anything to block during her absence).

When it comes to coding, I guess Mike is the best person to talk to? Same thing for the website transfer: I saw that a few authors don't know whether to post on the old one or the new one so I guess this is an issue that needs to be fixed to and I wonder how wa can do that together.

Keep me posted,

++

G.
--


Giulia Palmieri
Marketing & Communications Jedi
Direct Line : +33 472 444 423
http://about.me/giulia.palmieri


Game Connection Europe 2014 - Paris Games Week ¦ October 29-31
www.game-connection.com
www.twitter.com/The_Gameco
www.facebook.com/Game.Connection.Official.Page

MIGS 2014 - Montréal ¦ November 1O-11

Tamás Szelei

unread,
Apr 30, 2014, 5:04:51 AM4/30/14
to altdev...@googlegroups.com
Hi Giulia,

I answered her email, also cc-ing you and Mike, you must have missed it. Basically, the final problems on altdev.co are CSS issues, for which I would need file-level access to resolve. Can you help with that?

As for the other question, I think the old site should be used until the new one is ready.

Regards,
Tamás Szelei


Joseph Simons

unread,
Apr 30, 2014, 10:35:18 AM4/30/14
to altdev...@googlegroups.com
Possibly it is my inexperience with Gists that is the problem then. I attempted to upload some code to a gist (https://gist.github.com/sigmel/0e4f7e1f09407e36a21c), but I am unable to locate the id anywhere. All I see is the name of the file that I uploaded. However, if I attempt to put in the "0e4f7e1f09407e36a21c" as the id, it appears to work. So I guess I can use that going forward then.

On an unrelated note, is the site generally pretty slow for people? I find that it seems to take a while for it to do anything for me. Not sure if this is something that is going to be remedied with the new site or not.

Adam Martin

unread,
Apr 30, 2014, 10:46:26 AM4/30/14
to altdev...@googlegroups.com
My firefox plugin says:

 0.3 seconds = download site
 2.3 seconds = run whatever Javascript and CSS code is used to post-process and display the site.

So, yeah, I'd say the site has a problem :). I'm assumign the old JS goes bye-bye when the new site goes live?

Joseph Simons

unread,
Apr 30, 2014, 10:47:56 AM4/30/14
to altdev...@googlegroups.com
What plugin is that? I'd be curious to try it out since I think my times would be way worse than that.

Adam Martin

unread,
Apr 30, 2014, 10:50:08 AM4/30/14
to altdev...@googlegroups.com
That's AppTelemetry, which is a crappy super-simple one.

If you browse the FF / Chrome plyugin sites (built-in to both browsers) you can find much better, more detialed ones.

Also, I believe both browsers if you go into their respective "Web Developer" modes show nice, detailed "loading timelines" of what happened, what it was waiting for, why, how long, etc.

Web debugging these days is awesome; if you haven't seen FF's 3D-debugging view, you should go have a play ;)

Joseph Simons

unread,
Apr 30, 2014, 11:42:10 AM4/30/14
to altdev...@googlegroups.com
Yea, just using the network debugger in FireFox, I have it taking 26265ms (26s) just to get the HTML from www.altdevblogaday.com (144.59KB). This is at work, so no bandwidth problems here :) Pinging the site only takes about 60ms as well.

rf...@tbrf.net

unread,
Jul 11, 2014, 9:28:48 AM7/11/14
to altdev...@googlegroups.com
Am I right in thinking that this plugin is not yet installed on the new
altdev.co site?

I've tried embedding a gist but the markup is just being spat straight
into the output.

- Richard

On 2014-03-05 13:45, Tamás Szelei wrote:
> Hello all,
>
> Harriet asked me to send a quick note about the syntax highlighting
> changes. As you might have noticed, there has been some problems with
> syntax highlighting lately. After some discussion, we came up with the
> following solution:
>
> The recommended way of inserting highlighted code snippets in your
> articles from now on is via GitHub Gists. If you are not familiar with
> them, Gists are much like an embedded YouTube video, except for source
> code. The process of inserting a code snippet in your articles is the
> following:
>
> 1. Go to https://gist.github.com/ [1]
> 2. Create and save a gist.
> 3. Copy the numeric gist id and insert the shortcode [gist id="number
> here"] in the post. A formatted code block will appear.
>
> Example:
>
> To insert this gist, the code is [gist id="9366176"]
> You can see what it looks like here:
> http://www.altdevblogaday.com/?p=31103&shareadraft=baba31103_531713e68ca20
> [2]
>
> The following plugin is used for the shortcode:
> http://wordpress.org/plugins/gist-github-shortcode/ [3]
>
> The main advantage is that your code is not affected by the HTML
> filtering in wordpress, but the filtering still secures the site. Of
> course, this solution does have some drawbacks (e.g. too many iframes
> might slow down page load).
> If that is a substantial problem for some articles, the old plugin is
> still in place and can be used with admin help I suppose (to avoid
> filtering).
>
> Regards,
> Tamás
>
> --
> You received this message because you are subscribed to the Google
> Groups "AltDevAuthors" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to altdevauthor...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out [4].
>
>
> Links:
> ------
> [1] https://gist.github.com/
> [2]
> http://www.altdevblogaday.com/?p=31103&amp;shareadraft=baba31103_531713e68ca20
> [3] http://wordpress.org/plugins/gist-github-shortcode/
> [4] https://groups.google.com/groups/opt_out

Mike Acton

unread,
Jul 11, 2014, 1:24:49 PM7/11/14
to altdev...@googlegroups.com
What's the plugin that is needed?


--
You received this message because you are subscribed to the Google Groups "AltDevAuthors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altdevauthors+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Fine

unread,
Jul 11, 2014, 1:37:20 PM7/11/14
to altdev...@googlegroups.com
On 11/07/2014 18:24, Mike Acton wrote:
What's the plugin that is needed?

http://wordpress.org/plugins/gist-github-shortcode/

(I'm not particularly attached to using gist for source snippets but as far as I could tell this is the 'current solution' we're supposed to be using for syntax hilighting? If you want to find some other plugin that does it better then that's fine with me too...)

- Richard


--
You received this message because you are subscribed to the Google Groups "AltDevAuthors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altdevauthor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "AltDevAuthors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altdevauthor...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages