Wednesday, April 7, 2021

old school mac command line search and replace

 Aargh! I was digging "Prettier" as a plugin for VS Code, but it has an irreconcilable difference opinion from my team on bullets in markdown  -- namely if - or * should start an unordered list item. Apparently this is an issue of some holywar, opinionated tool crap and I have already wasted enough time for it, so here is an old school command line thing that seems to fix it for me:

find . -name "*.mdx" -exec sed -i '' 's/^\- /\* /g' {} \;

That says, find every markdown file (*.mdx) and run the old sed command ... -i with '' says don't make a backup file, the regex is beginning of line and a dash and a space replaced with a star and a space, globally. 

Kind of sucks but easier than wrestling with Prettier config or eslint plugins right now.

No comments:

Post a Comment