Converts Markdown to a DocX file, allowing you to output Word files from your C# application via Markdown.
In order to build the project you will need to install the Open XML SDK 2.5 and add a reference to DocumentFormat.OpenXML if it does not exist
The main method in MD2OXML is CreateDocX, which takes two string values - the markdown, and the path where you want to store the file:
using MarkdownToOpenXML;
string markdown = @"# This is a header";
MD2OXML.CreateDocX(markdown, @"C:\MyMarkdown.docx");
Headers can be produced either the atx style or setext style.
An ATX style header has a number of hashes at the beginning of the line to signify a header:
# This is an H1
## This is an H2
###### This is an H6
You can optionally close atx headers:
# This is an H1 #
## This is an H2 ##
### This is an H3 ###
A setext header is underlined by either equal signs or dashes on the next line:
This is an H1
=============
This is an H2
-------------
By default MD2OXML is set to use it's own extended formatting syntax, adding in support for underline.
**Bold text**
`Italics`
_Underlined text_
However you can set the syntax back to the original markdown rules by setting the ExtendedMode flag to false:
MarkdownToOpenXML.MD2OXML.ExtendedMode = false;
This will then support this syntax:
*Italic* out puts italic text and **bold** outputs bold text
This is something that isn't seen in markdown parsers for the web as placement would normally be dealt with by CSS styles. However MD2OXML supports inline alignment statements that should be placed at the start of a line:
>< This centers the text
<> This fully justifies the text
>> Right alignment
<< Left alignment