Code Monkey home page Code Monkey logo

markdowntoopenxml's Introduction

MarkdownToOpenXML

Converts Markdown to a DocX file, allowing you to output Word files from your C# application via Markdown.

Building project

Clone the repository, open in Visual Studio, and build. All dependencies (such as DocumentFormat.OpenXML) are Nuget packages.

Getting started

Usage

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");

Current syntax support

Headers

Headers can be produced either the atx style or setext style.

ATX

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 ###
Setext

A setext header is underlined by either equal signs or dashes on the next line:

This is an H1
=============

This is an H2
-------------

Formatting

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

Alignment

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

markdowntoopenxml's People

Contributors

dangerdan avatar mirhagk avatar seankilleen avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.