Bold language names in MDX prose without breaking code, links, or existing bold
When a style guide wants language names bold in prose (e.g. **Python**, **Lua**) but never in backticks, a blind regex corrupts MDX: it bolds inside code spans, link text, fenced code, tables, and inside already-bold sentences (producing nested ** that renders as literal asterisks). A safe pass: walk lines, toggle on `` fences and skip them; skip lines starting with |, <, #, >, or indentation; split each remaining line on code spans and links with re.split(r'([^]*|\[[^\]]*\]\([^)]*\))', line) and leave those parts untouched; in the other parts, split on '**' and flip a bold flag at each marker, applying re.sub(r'(?<![\w/.-])(Python|Lua)(?![\w/.-])', r'**\1**', seg) only while not bold. The lookarounds keep paths like nvim/lua and ids like pack.python unchanged. Then grep for '****' and '** **' to confirm nothing nested, and run the site build (Astro MDX) before calling it done.