I use some liquid markups in Jekyll, they are not available in Hugo.

I made a script to convert them:

import re
from pathlib import Path

CURRENT = Path(__file__).resolve().parent
posts = CURRENT.parent.joinpath(r"content\post")

mds = posts.glob("*.md")

for md in mds:
    content = md.read_text(encoding="utf8")
    target = []
    # working: ![tree](/assets/Tree.png)
    for line in content.split("\n"):
        # ![img]({{ site.url }}/assets/sgame-new-match-ui.png)
        if "site.url" in line:
            line = re.sub(r"{{ *site.url *}}", "", line)
            # content = content.replace("{{ site.url }}", "")
            # print(line)
        elif "relative_url" in line:
            print("from:", line)
            #  {{ 'assets/package-result.png' | relative_url }}
            line = re.sub(r"{{ *'(.+)' *\| *relative_url *}}", r"/\1", line)
            print(line)
        target.append(line)

    md.write_text("\n".join(target), encoding="utf8")

I get some whitespace differences, but I git rid of them by:

git stash
git stash pop

I use python capture groups

It’s better to add check to see if regex matches, and investigate further the whitespace difference issue.

But there are just a few of them so no more time spent here 😄

(P.S. smile face added via hugo emojis)