In yesterday's post, I've presented a Python script to convert Pelican preamble files to YAML for Hugo.

For some UTF-8 files, these is a BOM marker at the beginning of the file. The script (as a true quick and dirty solution) doesn't check the presence of such marker and it cannot detect the Title element if it exists.

I added an fm = fm.strip('\ufeff') line to clear BOM marker from a line if it exists.


There is an editor called bvi to edit binary files in Hex format, similar to vi editor.


It's possible to get a section from a markdown file like

sed -n -e '/^#/,/^#/p'

command. It's possible to put line numbers instead of regexes as well and p at the end is the print command, which can be replaced by, e.g. d to delete the lines.