matti
matti

@help What is the proper way to enable syntax highlighting in my blog? I found this and this in the help forum, but it seems rather bothersome for such a basic functionality, especially since hugo supports syntax highlighting now. Can I hope for a hugo update anytime soon?

|
Embed
Progress spinner
help
help

@matti I want to update Hugo soon, but I want to make sure nothing will break. I'd like to have both old and new versions available so we can slowly move to it. Most likely there will be a way to "opt in" to the new version first.

|
Embed
Progress spinner
matti
matti

@help is there a more specific time frame? Is it worth my time to try to get prismjs working? @Moondeer‘s Plugin doesn’t seem to be in the list of plug ins…

|
Embed
Progress spinner
Moondeer
Moondeer

@matti I'm touching up the plugins to get them all in line with the best practices and parameter paradigm I developed along the way. Afterwards, I'll register them with @manton's new process.

You can install the prism plugin right now the same way that I do. Go to Design -> Edit Custom Themes -> New Plugin

Name it whatever you like and stick the repository address in https://github.com/moonbuck/plugin-prism. The plugin will be cloned in the exact same manner as through the registered list of plugins.

I believe the README is up to date for the current version. Regardless, it's what I use for all the syntax highlighting so holler if you end up with questions: the blog post README version

|
Embed
Progress spinner
matti
matti

@Moondeer Thanks! Sadly, this has the same problem that my attempt of adding prismjs directly to the template had: Double curly braces are not rendered correctly, neither literal ones, nor htmlencoded ones. Hard to believe that mb has no reliable syntax highlighting…

|
Embed
Progress spinner
Moondeer
Moondeer

@matti I created a shortcode for syntax highlighting shortcodes. I use it for the opening braces and less than … same thing oughta work for just the braces. I have gotten around a lot of quirks bit new ones are always popping up. So far I've figured out how to highlight anything I've thrown at it … but I don't always remember how I did it. The shortcode post

|
Embed
Progress spinner
Moondeer
Moondeer

@matti you also have to be careful when opening up posts to tinker with encodings … they get decoded when you reopen and you have to re-encode them. I use my test blog to see how the highlighting looks … tinker with whatever went wrong and then post to my main.

|
Embed
Progress spinner
matti
matti

@Moondeer I admire your perseverance, but these kinds of gymnastics are at least slightly ridiculous. @manton This screams for an actual user-friendly solution.

|
Embed
Progress spinner
matti
matti

@Moondeer Yeah. I'm doing and have noticed the same. Posts with go html/template code blocks break the post editor in a way that prevents select all from working correctly.

|
Embed
Progress spinner
Moondeer
Moondeer

@matti I run into that all the time when copying/pasting templates. Yet to figure out what separates the ones that break it and the ones that don't.

|
Embed
Progress spinner
Moondeer
Moondeer

@matti The Hugo parser is constantly getting in the way. To go around it I've had to do thinks like the shortcode (cause then whatever is inside doesn't get parsed again) and in other cases I literally have to parse and correct the content with regular expressions. Nothing has made appreciate what I had with Swift than d$cking around with Hugo and Javascript

|
Embed
Progress spinner
Moondeer
Moondeer

@matti It's funny. Trying to get the Hugo in all the READMEs to render was a b$tch. I just remembered that some double curlies would be cool and others would totally break. Not sure if I figured that one out or decided I didn't need to show the partial. This was before I figured out the shortcode hack. Thst probably would have solved it.

|
Embed
Progress spinner
matti
matti

@Moondeer Maybe mb should set their eyes on jekyll instead of hugo 0.60?

|
Embed
Progress spinner
matti
matti

@Moondeer I would be totally fine with using Hugo's highlight shortcode, which seems to be working here locally in a quick test I just did without problems. I couldn't test it on Version 0.54 though since that version is just so old.

|
Embed
Progress spinner
Moondeer
Moondeer

@matti They may have fixed the false positive parsing entirely for all we know, what are they up to now, like 0.late-80s? In 0.54 … we can't even merge maps.

|
Embed
Progress spinner
matti
matti

@Moondeer I tested it with hugo version 0.54.0 and mb's default theme locally and it totally works.

|
Embed
Progress spinner
manton
manton

@matti @moondeer This conversation also reminded me that Micro.blog attempts to escape “{“ in some cases. I’m going to look at this again and see what I can improve. Thanks!

|
Embed
Progress spinner
Moondeer
Moondeer

@matti interesting … so much is still a blackbox for me. I just tinker until I get results. My two favorite finds are the config directory (which take precedent ahead of the json files) and the assets directory (with which you can build Javascript and Sass files from templates).

|
Embed
Progress spinner
sod
sod

@matti @moondeer We could monkey patch the built-in highlight shortcode to play better with Micro.blog. As an interim solution until @manton updates Hugo to a newer version. I have a plug-in working with decent results on the default theme.

Feel free to install and play around with Highlight Monkey. 🙈

|
Embed
Progress spinner
manton
manton

@sod @matti @Moondeer Very cool! Just tested the plug-in and it works well for me. Heads-up: I'm also fixing an escaping bug with {{ in code blocks today and rolling out an option for Hugo 0.91. I'll blog about it when it's live.

|
Embed
Progress spinner
Moondeer
Moondeer

@sod @manton @matti I've head great success with mine as well (just gotta jump through some hoops when the code is Hugo code): plugin-prism. It also loads various prism plugins (so you can have a code copy button, for example).

You can see it in action via the walkthrough I've been working on.

You can find a bunch more by entering README into my site's search box.

|
Embed
Progress spinner
sod
sod

@Moondeer Yeah, I stumbled upon your plug-in; it's awesome and way more polished than my approach. Mine is mostly a proof of concept. Nevertheless, I thought it worthwhile to experiment with monkey patching the built-in highlight shortcode for two reasons.

First, it works without JavaScript, and second, Hugo template code "just works." So no jumping through hoops is necessary.

But, with @manton rolling out changes today, my plug-in will probably soon be obsolete.

|
Embed
Progress spinner
matti
matti

@manton Uhhh. That sounds great!

|
Embed
Progress spinner
matti
matti

@sod Very nice. Thanks for the info! Seems like it won't be necessary anymore but nice nonetheless.

|
Embed
Progress spinner
manton
manton

@sod I think it's going to be a while until we can upgrade everyone to a new Hugo (some things definitely break in my initial tests), so the plug-in may be useful for some time.

|
Embed
Progress spinner
Moondeer
Moondeer

@sod @manton @matti I tend to tinker just to see what can be done (why I never really finished any of the iOS apps). My approach rebuilding the cards plugin is way beyond what I was doing when I started. So now I'm going back through and getting all the plugins inline with plugin-cards … which is mostly about consistency and parameterizing the sh$t out of everything since any Javascript or stylesheets will be templated and built at compile time. I've gotten to a few of them but no READMEs have been updated. Side note: plugin-programmable-search-engine and plugin-toc are pretty sick as well. I created the site search plugin just before rebuilding plugin-cards and I actually created the table of contents plugin when I realized just how ginirmous that walkthrough I linked was getting.

|
Embed
Progress spinner
matti
matti

@manton raises hand I think I would be a good test candidate for the new Hugo version: I do not have that much content, since I have only been here a few months. 😉

|
Embed
Progress spinner
mandaris
mandaris

@manton could we get a page on what versions were on for future plug-ins? What version are we on now?

|
Embed
Progress spinner
Moondeer
Moondeer

@sod @matti @manton Turns out the new Hugo installation isn't compiled with Sass support, which is a regression and a deal breaker for everything I've touched. Glad you kept the upgrade opt-in.

|
Embed
Progress spinner
manton
manton

@Moondeer @sod @matti Updated to the extended Hugo release. Thanks! Still have a couple things to fix with the default config.

|
Embed
Progress spinner
manton
manton

@mandaris The default right now is 0.54. We're going to jump to 0.91 but it will be opt-in for a while, on the Design page. I expect themes will need updates.

|
Embed
Progress spinner
manton
manton

@matti Okay, there's an option for Hugo version now on the Design page. Enjoy! Probably some rough edges still.

|
Embed
Progress spinner
Moondeer
Moondeer

@manton I thought you might but didn't want to assume. Much appreciated!

|
Embed
Progress spinner
maique
maique

@manton Updated mine to 0.91, nothing seems to be broken. Modified Kiko.

|
Embed
Progress spinner
manton
manton

@maique I think the home and photos pages need to be updated to show posts. I'll be going through the themes and updating them as I run into problems.

|
Embed
Progress spinner
maique
maique

@manton Oops! Spoke too soon! Maybe I checked before the rebuild was done? It's broken, you're right...

|
Embed
Progress spinner
sod
sod

@manton Woohoo! 🎉

|
Embed
Progress spinner
Moondeer
Moondeer

@sod It occurs to me I probably oughta look at how you did it … I'm on an island figuring this stuff out through mostly trial and error (I did at least consume some fresh books on Javascript and CSS to refresh my memory (and solidify my love for the Swift programming language … what I would give to be coding this stuff in Swift)).

|
Embed
Progress spinner