DrolleryMedieval drollery of a knight on a horse
flowery border with man falling
flowery border with man falling

This is just an example of some code blocks for testing rehype prism.

This is the time parser I use for Planwarrior. As you can see on lines 1-3 I have a timestr function which takes a string representation of time (`4:03`) and then determines how many minutes that is since midnight:

def time_str(s):
    h, m = [int(x) for x in s.split(':')]
    return h * 60 + m


def plan(plan):
    return {
        time_str((y := x.strip().split(' '))[0]): ' '.join(y[1:])
        for x in plan.strip().splitlines()
    }

Here are some utility functions I am using for the Planwarrior project:

def peek_and_lookback(cur):
    prv = [None] + cur[:-1]
    nxt = cur[1:] + [None]
    return zip(prv, cur, nxt)


def peek(x):
    p = x[1:]
    p.append(None)
    return zip(x, p)


def wrap_ansi(s, code='green'):
    c = {
        'bold': ['\033[1m', '\033[00m'],
        'italic': ['\033[3m', '\033[00m'],
        'underline': ['\033[4m', '\033[00m'],
        'strike': ['\033[9m', '\033[00m'],
        'green': ['\033[0;32m', '\033[00m'],
    }
    d = 'green'
    return f"{c.get(code, d)[0]}{s}{c.get(code, d)[1]}"


def pad_maybe(i):
    return str(i) if len(str(i)) > 1 else f"0{i}"