7c0h

Articles tagged with "pelican"

Pelican broke on me

As I mentioned a long time ago I am using Pelican for publishing my blog. I recently did an upgrade which broke the syntax highlighting, and I thought I should take a short time to explain how to fix it because I couldn't find a solution anywhere.

The problem: it used to be the case that you could write your code like this and it would do what you'd expect:

```
:::python
print('Hello world')
```

But since some version this syntax is no longer valid, resulting in a plainly visible syntax identifier and the wrong colors being used in the highlighting:

:::python
print('Hello world')

The solution is simple: change to the other style for writing code in Markdown, like so (note the leading spaces):

    :::python
    print('Hello world')

And that solves the issue.

print('Hello world')

I shouldn't forget to mention that this change forced me to re-indent all of my code samples: the reason I was using the triple backquotes format was because it lets me indent at the 0-th column, while the new syntax forces me to indent everything with four leading spaces. And you know what happens with Python code when you accidentally miss four spaces, i.e., one indentation? It breaks in marvelous and unexpected ways! Ensuring that every single line of code was properly re-indented was not a fun task, but a necessary one nonetheless.

Which brings me to my final point. I thought I was used to the whole "indentation has meaning" thing, but I have to say: only after using Rust at the end of last year and going back to braces to delimit code blocks did I realize how much I've missed them.