rips off all the sample code from the projects composer uses, as well as https://codepen.io/MrHuds0n/full/bgWdqe for the bbcode output.
usage:
composer install
# (put a single .lyx file into the directory)
sh generate.sh
edit generate.sh as needed to fix paths (you'll need to do this, trust me). also check out the top of mdToBBC.php.
this code is all shit patched together with more shit, so that it can handle my very specific and narrow use case.