The best way for testing locally documents in Markdown is to use pandoc with latex-engine:
pandoc README.md --latex-engine=/Library/TeX/texbin/xelatex -o g.pdf && o g.pdf
Notice: the generated pdf will slightly differ from what you see in github/gitlab.
For MacOS, you will need to install mactex and pandoc.