Alex Schroeder ๐Ÿ is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Alex Schroeder ๐Ÿ @kensanata

Writing a filter that will render markdown or highlight source code, the way GitHub does it, more or less. I find that my repos sometimes have "important" information in files other than README.md.

ยท Web ยท 0 ยท 0

Gah, it sort of works. I don't want the line numbers., and it's wrapped in a pre tag, and a code tag (!?)... I guess I could fake it by adding extra closing and opening tags, and CSS to hide the line numbers? But I'm not liking this...

Oh ye Gods of Algorythms and Elegance, forgive me for I have sinned! This blog post shows how to have highlight source code and render Markdown. If you can read code, please don't click. If you host cgit, you might want to take a look?
alexschroeder.ch/wiki/2018-06-

Also I hate typos! But that goes without saying, right?

@deshipu The two existing source files were written in Python and I donโ€™t have the urge to rewrite anything to Perl. There just wasnโ€™t ever a reason use Python and I donโ€™t think I would use it for a new project unless the library situation pushes me to do. But increasingly, it does... (like Mastodon.py)

@deshipu No reason except thatโ€™s what the existing code used. I wondered myself. Just for symmetry because of the sys.stdin code?

@kensanata Personally I like to use the fileinput module โ€” it basically gives you what Perl has by default โ€” standard input or passed files. docs.python.org/2/library/file