Convert a DataTable to a Markdown table

I am working on a project in which I want to export some tabular data in Markdown. I started writing methods to do this with each set of data, but that got to be tedious.

I thought instead it would be easier to get the data into a DataTable then just have a generic method that converts a DataTable to Markdown. That idea became a new extension method that I thought I would share on in case anyone faces a similar problem in the future.

Use of this code is subject to the terms of use.