Office Add-in that converts directly between Word and Markdown formats
Use the Word.js APIs to convert a Markdown document to Word for editing and then convert the Word document back to Markdown format, using the Paragraph, Table, List, and Range objects.
Table of Contents
- Change history
- Prerequisites
- Test the add-in
- Known issues
- Questions and comments
- Additional resources
Change history
December 16, 2016:
- Initial version.
Prerequisites
- Visual Studio 2015 or later.
- Word 2016 for Windows, build 16.0.6727.1000 or later.
Test the add-in
- Clone or download the project to your desktop.
- Open the Word-Add-in-JavaScript-MDConversion.sln file in Visual Studio.
- Press F5.
- After Word launches, press the Open Converter button on the Home ribbon.
- When the application has loaded, press the button Insert test Markdown document.
- After the sample Markdown text has loaded, press the button Convert MD text to Word.
- After the document has been converted to Word, edit it.
- Press the button Convert document to Markdown.
- After the document has converted, copy and paste its contents into a Markdown previewer, such as Visual Studio Code.
- Alternatively, you can start with the button Insert test Word document and convert the sample Word document that is created to Markdown.
- Optionally, start with your own Markdown text or Word content and test the add-in.
Known issues
- Due to a bug in the way that programmatically-created Word lists are created, the Markdown-to-Word will only correctly convert the first list (or sometimes the first two lists) in a document. (Any number of Markdown lists will convert correctly to Word.)
- If you convert the same document repeatedly between Word and Markdown back and forth, all of the rows in tables will take on the formatting of the header row, which usually includes bold text.
- The add-in uses some Office APIs that are not yet supported in Word Online (as of 2017/2/15). You should test it in desktop Word (which opens automatically when you press F5.
Questions and comments
We'd love to get your feedback about this sample. You can send your feedback to us in the Issues section of this repository.
Questions about Microsoft Office 365 development in general should be posted to Stack Overflow. If your question is about the Office JavaScript APIs, make sure that your questions are tagged with [office-js] and [API].
Additional resources
- Office add-in documentation
- Office Dev Center
- More Office Add-in samples at OfficeDev on Github
Copyright
Copyright (c) 2016 Microsoft Corporation. All rights reserved.