Site updates! July 19, 2017

Today I thought my blog needed some updates, so I updated it. Here's a quick summary of what's new:

Switched to mistune

I switched from using the markdown2 Python markdown renderer library to mistune. It just does more things, and looks cooler. Also, it's supposed to be faster, so that's a bonus (my blog renders the markdown on request - not sure if that's a bad thing???)

Also, now I can have code links!

Code blocks

markdown2 didn't really have code blocks out of the box.

mistune does!

isn't that cool?

(of course, there *is* an extension for code blocks with markdown2, but I never really got around to doing it :P)

Syntax highlighting

Now we have code blocks with syntax highlighting! (This wasn't built in, but wasn't hard to implement :P)

I'm using the Dracula theme for Pygments. I was kinda hesitant about having all this colour - this site has a bit of a greyscale theme - but you can tell me what you think.

BOARD_SIZE = 8

class BailOut(Exception):
    pass

def validate(queens):
    left = right = col = queens[-1]
    for r in reversed(queens[:-1]):
        left, right = left-1, right+1
        if r in (left, col, right):
            raise BailOut

def add_queen(queens):
    for i in range(BOARD_SIZE):
        test_queens = queens + [i]
        try:
            validate(test_queens)
            if len(test_queens) == BOARD_SIZE:
                return test_queens
            else:
                return add_queen(test_queens)
        except BailOut:
            pass
    raise BailOut

queens = add_queen([])
print queens
print "\n".join(". "*q + "Q " + ". "*(BOARD_SIZE-q-1) for q in queens)

(code taken from the python wiki)

Inline HTML

I figured out that one of the defining features of Markdown is that you can stick HTML anywhere in the document. So I can do stuff like this marquee tag. (Sorry.)

Stylesheet updates

I made some updates to the stylesheet:

That's it!

Just wanted you to know that this blog's not dead - I'm working on another post right now!

If you want to see the actual code changes for whatever reason, here you go. (This link might not work in the future?? how do I get a futureproof link :P) figured it out!


write a comment

fl July 20, 2017, 1 p.m.

🎉 btw, theoretically the link to the code changes (under "That's it!") won't be relevant later, because master@{1day} will become different?

__init__ July 20, 2017, 3:53 p.m.

fl: Exactly - how do I make a link that doesn't do that?

__init__ July 20, 2017, 3:58 p.m.

fl: Figured it out! https://github.com/TheInitializer/blog/compare/master@%7B2017-07-18%7D...master@%7B2017-07-20%7D