got an answer from Eric Blake on the M4 mailing list: http://lists.gnu.org/archive/html/m4-discuss/2015-04/msg00004.html
changequote is your friend. This will do it:
define(`md_code', changequote([,
])[changequote([,])```changequote(`,')]changequote(`,'))
I have to change quotes twice: once around the macro definition, since
the definition itself intends to use (backticks) in an unbalanced manner; and
again in the macro expansion, since the expansion will output backticks in an
unbalanced manner; for each changed quote, the original quotes must be
restored. This assumes that the default quoting stays at (backticks) '
throughout the m4 run.
Although in your case, I'd recommend using changequote up front to
something else, and globally write your input under those quoting
rules instead of the default (backticks) ' quoting rules. Remember that
autoconf intentionally went with [ ] as the quoting characters,
because they were much likely to be balanced in output, as opposed to
(backticks) and ' not occurring in balanced pairs in shell scripts. In fact,
choosing 2- or 3-byte quoting strings is even less ambiguous, although
it then requires more typing.