WordPress: Restrict MathJax to a class

I write on a variety of topics, only some of which it's appropriate to have mathematical typesetting for. To avoid triggering a math rendering engine on unrelated use of $spurious dollar signs$, while activating it when $\text{necessary}\wedge\text{appropriate}$, I decided to restrict them to only elements with .mathjax. Here's how that's done: MathJax = { tex:…

Converting SVG to .ico with Python

Just a super rudimentary script that I made which hooks CairoSVG up to Pillow because apparently Firefox doesn't support SVG-formatted browserAction images: import cairosvg.surface from PIL import Image from io import BytesIO def svg2ico(*args, resolutions={96, 48, 32, 24, 16}, write_to=None, **kwargs): t = cairosvg.surface.Tree(*args, **kwargs) ims = [] for res in resolutions: cairosvg.surface.PNGSurface(t, f:=BytesIO(), res…

Applying highlight.js to inline code on WordPress

If you're using the plugin Prismatic to apply highlight.js to your code excerpts, but you want it to also affect inline <code> tags (i.e. those not wrapped in <pre> blocks), simply go Settings > Prismatic > Highlight.js and paste this monster into the “Init Script” field: // This init script was written by James E.…