This is a way to create d2l content for input using markdown. To install, just curl the .phar file. Something like this:
curl -O https://rhildred.github.io/d2lview/d2lview.phar
If you want to make it useable from anywhere, copy it in to your path on osx like:
sudo mv d2lview.phar /usr/local/bin/d2lview
When it is installed, you can export a shell (or use the one here). Add content in markdown and include it in .phtml files per the examples.