ectms / Word-Add-in-MarkdownConversion

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Convert between Word and Markdown

Table of Contents

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

  1. Clone or download the project to your desktop.
  2. Open the Word-Add-in-JavaScript-MDConversion.sln file in Visual Studio.
  3. Press F5.
  4. After Word launches, press the Open Converter button on the Home ribbon.
  5. When the application has loaded, press the button Insert test Markdown document.
  6. After the sample Markdown text has loaded, press the button Convert MD text to Word.
  7. After the document has been converted to Word, edit it.
  8. Press the button Convert document to Markdown.
  9. After the document has converted, copy and paste its contents into a Markdown previewer, such as Visual Studio Code.
  10. Alternatively, you can start with the button Insert test Word document and convert the sample Word document that is created to Markdown.
  11. 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

Copyright

Copyright (c) 2016 Microsoft Corporation. All rights reserved.

About

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.

License:Other


Languages

Language:JavaScript 77.7%Language:CSS 15.3%Language:HTML 5.1%Language:C# 1.9%