# Working with DOCX

Marked has extensive support for working with Microsoft Word files.

Contents

- Opening DOCX files
- Exporting DOCX files
- Change Tracking
- Math
- Adding Custom Export Styles

## Opening DOCX files

Marked can read a DOCX file and convert it to clean Markdown. Valid style elements like headlines and lists will be converted to their Markdown equivalent.

Change tracking and comments will be converted to CriticMarkup. Highlights will be converted to `<mark>` tags, with colors where appropriate.

## Exporting DOCX files

Use the Export palette to generate a DOCX file from your Markdown. In the save dialog you can specify a built-in styles — this style can easily be changed in Word just by opening the theme selector and selecting a new theme.

## Change Tracking

CriticMarkup syntax in a Markdown document will be converted to Word Change Tracking when exported to DOCX. Comments following insertions, deletions, and substitutions will appear in the right hand column in Word when change tracking is enabled.

When importing a DOCX file in Marked, change tracking will be converted to CriticMarkup and `<mark>` tags as appropriate.

## Math

MathJax and Katex equations displayed in the document will be converted to MathML for display in Word. This conversion isn’t perfect, but in most cases will render a valid math block in the word document. This only applies to export — math blocks in Word documents will not be converted when importing.

## Adding Custom Export Styles

You can add your own export styles by including a template and a styles.xml file in `~/Library/Application Support/Marked/Custom Word Styles/`. To create these:

1. Open a Marked-generated DOCX file in Word
2. Edit the styles there in the Style editor for each element, selecting “Add to template” for each one.
3. Save the DOCX file.
4. Generate a template by going to Design in the top bar, and from the Template dropdown on the left, click Save current template. Name it as you want it to appear in the Marked style menu and save it to `~/Library/Application Support/Marked/Custom Word Styles/STYLENAME.thmx`, where `STYLENAME` is the name of your style.
5. Go to Finder and locate the DOCX file you saved from Word. Duplicate it and rename the copy to `FILENAME.zip` and double click it to unzip.
6. In the unzipped document, you’ll see a “word” folder containing a styles.xml file. Copy that styles.xml file to the same folder as above, and name it `STYLENAME.xml` (where `STYLENAME` is the name of your style). The `.thmx` and `.xml` files should have the same base name (just different extensions).

The next time you export a DOCX from Marked, you’ll see your new style in the Style menu of the Save dialog.

#### Next up: Link Validation ▶

Support Site | Knowledgebase