Members Only

Going From Markdown to InDesign

How to use Markdown as an authoring tool in InDesign workflows

This article appears in Issue 146 of InDesign Magazine.

InDesign Magazine Issue 146 coverThis article appeared in Issue 146 of InDesign Magazine.

Not everyone uses Microsoft Word to write and format text documents destined for an InDesign page. Increasingly, people are turning to alternatives to Word, such as Google Docs and InCopy. But there is yet another class of options: plain-text editors, such as BBEdit, Sublime Text, Atom, or even just Notepad. Of course, at first glance it seems that text editors don’t support text formatting, but there’s a workaround in the form of very simple Markdown codes that you can add as you type.

This article will show you a method for getting content from Markdown to InDesign with the help of something called Pandoc. I admit that this is going get a bit geeky (there will be code and Terminal or PowerShell commands), but once you have all the pieces set up, the workflow is relatively straightforward. So pour yourself a stimulating beverage, and let’s have at it.

What Are Markdown and Pandoc?

Created by John Gruber in 2004, Markdown is a lightweight markup language with a simple formatting syntax. It is written as plain text and is often used for creating rich text using a plain-text editor. It’s great for doing things like formatting readme files or writing messages in online forums. If you’re familiar with HTML, you’ll notice a few similarities between the two markup languages, though Markdown tends to be easier for newcomers to read and use. To learn more about the Markdown language, check out the Wikipedia article here.

Pandoc is a document converter that was created in 2006 by John MacFarlane. It is an incredibly powerful and versatile command-line utility that can import a document from more than 20 supported file formats and convert its markup to another format. In addition to its extensive native capabilities, it also allows you to write custom plug-ins and filters using the Lua scripting language. Pandoc’s extensive library makes it the perfect tool for converting Markdown files to various other formats including InCopy (ICML) and Word (DOCX). To learn more about Pandoc, check out the Wikipedia article here.

The first step in converting documents using Pandoc is getting it installed. Windows and macOS users can download the Pandoc installer here. Alternatively, if you are the kind of person who feels comfortable using the command line and you have Homebrew installed, then you can also install Pandoc by following the instructions here.

Writing in Markdown

The Markdown syntax was created with readability in mind, and for that reason, it is very easy to write. Begin by opening your favorite text editor. You can use any text editor, because Markdown is written in plain text. I often just use the default text editor that ships with macOS, TextEdit. However, there are dozens of free and commercial text or code editors for macOS, Windows, Linux, Android, and even iOS—including some that are specifically designed for working with Markdown.

Let’s go over some of the basics of Markdown.

Header and body text

First, all text written on unmarked lines will be treated as normal body text in Markdown. To start a new paragraph of body text, make sure you insert a blank line (two line-breaks in a row).

Markdown treats any lines that begin with a hash (#) and space character as header text. A single hash followed by a space it considers equivalent to h1, two hash symbols it considers as h2, and three hash symbols Markdown considers h3 (Figure 1).

Figure 1. Header syntax in Markdown

If you want a bulleted list, start your line with a hyphen character, followed by a space (Figure 2).

Figure 2. Bulleted list syntax in Markdown

Similarly, lines that begin with a number followed by a period will be considered part of a numbered list (Figure 3).

Figure 3. Numbered list syntax in Markdown

Tables

Markdown supports three approaches to creating tables. You can create a table using the Pipe Table, Grid Table, or Simple Table syntax. I personally prefer to use the Pipe Table syntax, because I find it easier to read and write but any method you choose will result in a table in your output document, so use the one you like best (Figure 4).

Figure 4. Examples of a Pipe Table (top), Grid Table (middle), and Simple Table (bottom)

Images

To insert an image into your document, start by adding an exclamation mark (!). Then put the alt text in brackets, followed by the relative path or URL to the image asset in parentheses. If you want to add a title, put it in quotes after the URL in the parentheses.

Figure 5 shows an example of an image that has alt text in Markdown.

Figure 5. Image syntax in Markdown

Custom styles

What about those times where you need to step outside of the traditional h1, h2, and h3 styles? No worries, Pandoc has a way of handling custom styles as well! You can create and implement custom styles on both the character level and the paragraph level using basic Markdown syntax.

You can apply a character style to text inside a paragraph by using a combination of square and curly brackets (Figure 6).

Figure 6. Character styling syntax in Markdown

Paragraph styles are, of course, very important to InDesign users. You can apply a paragraph style by starting a line with three colons followed by some code that includes the style name. Figure 7 offers a look at applying a custom style to an entire paragraph.

Figure 7. Paragraph styling syntax in Markdown

The style names that you create for any custom styles will also need to be configured in something called a “style reference document.” Read on for more information about that.

Of course, there are dozens more formatting codes available in Markdown. For a comprehensive Markdown cheat sheet, check out the guide at Github or go right to the source: John Gruber’s Daring Fireball site.

Figure 8 shows an example of a Markdown file that contains a lot of the commands that I mentioned above. The file shown here can also be found in the downloadable files for this article.

Figure 8. A Markdown document

Converting to DOCX

It would be great if you could place Markdown files directly into InDesign, but you can’t. InDesign doesn’t recognize the .md file extension as something it can handle, so it’s just grayed out in the Place dialog box. You can’t even place it as plain text. You need to convert Markdown files to something InDesign does understand: Microsoft Word documents in the form of DOCX files. As I mentioned earlier, the best way to do that is to use Pandoc. When converting to DOCX, you need to concern yourself with two main components: images and styles. 

Images are easy enough to take care of with a little planning. You just need to be sure that the image format you used is supported in a DOCX document. This means that you should stick to the basic JPG or PNG whenever possible.

Styles are a bit more complicated. Getting the DOCX styles setup for your converted documents will take a bit of work up front, if it matters to you what the output looks like when it’s in DOCX form. However, whether you decide to perfect your styles in a DOCX document or not, you will need a style reference document for Pandoc to read the styles from when it converts your Markdown.

Creating a reference document

In the Markdown-to-InDesign workflow, a style reference document is simply a Word document that contains all of the styles that Pandoc will reference when it converts the Markdown file to DOCX. Pandoc duplicates this document and fills it with content from the Markdown file. The styles that you have defined in the reference document are then applied to that content Pandoc adds it.

To create a reference document, start with a new Word document and edit the default styles until you’re satisfied with their appearance. Remember that your final output document will use the styles you define here. Once you are done, save that file in a convenient location. I recommend saving the reference document in your Pandoc Workspace folder (more on that in a moment).

You can see what my style reference document looks like in Figure 9.

Figure 9. An example of a style reference document

Notice that I added text for each of the elements that I will use. This is the easiest way to see the edits that you make to style sheets as you make them. You can keep all of these style references on the page when you save your reference document. That will make it easier to distinguish between multiple style reference documents in the future.

Be sure to stick to the default styles in the DOCX document when creating your styles because those styles are the ones that Pandoc will use when it makes the conversion (with the exception of any custom styles that you create). You can read a great article here that details how to edit the default styles in a DOCX file. 

A Scripted Solution for Simple Documents

Would you like to try Markdown as an authoring tool but the idea of using Terminal makes your eyes glaze over? There is a scripted solution that can take your content directly from Markdown to InDesign. Written by Jongware, the script is called MarkdowntoID, and you can download it and learn how to use it here. There is one big caveat: The script does not support images. So if your documents contain them, you’ll need to stick to the method described in this article.

Pandoc Workspace Folder Structure

Let’s have a look at the folder structure that I recommend you use when creating a workspace for converting documents using Pandoc. When I say “workspace,” I am simply referring to a folder structure that will contain all of the files needed for the Pandoc workflow. (This is not the same as InDesign workspaces, which are arrangements of panels that you can save and switch between as you work on various tasks.)

Technically speaking, there is no need to create a specific folder structure for converting your documents, but I do recommend setting one up so that making conversions can be quick and painless. Think of your folder system setup as something akin to a templated workflow.

You can see my Pandoc Workspace setup in Figure 10.

Figure 10. An example of the preferred way of structuring your Pandoc Workspace folder

Setting your workspace folder up in this way will make it easier to reference images and utilities as you work on writing your Markdown file and eventually converting it. For example, all of the image paths in the Markdown document can use relative paths like images/bulleted-list-figure.png. Pandoc knows where to find that image because it understands the relative folder structure of the workspace folder.

Notice that I placed my style-reference.docx file in my pandoc-utilities folder. I did this so that the style reference document will be easier to access later in this process.

Any time that you change the name or path of your style reference document, you will also need to edit the file named 2docx.yml. This is a YAML file. YAML files are commonly used as configuration files where data can be quickly stored and transmitted. In this case, you’re going to use the YAML file format to store information about which version of Pandoc to use, which style reference that you want to use, and which filter should be applied when making the conversion. 

To update the file path to your style reference document, open the 2docx.yml file (in the downloads for this article) with any text-editing application. Edit the file path found on line 5 so that it points to the style reference document that you would like to use. If you are using the Pandoc Workspace folder structure that I suggested, then you can simply use a relative path from the top level of the workspace folder like I did in Figure 11.

Figure 11. A look at the 2docx.yml configuration file

Conversion Commands

At long last, we have come to the actual conversion process! Before we begin, I want to mention two things:

Remember that the workflow consists of converting your Markdown file to a DOCX file, and then placing the DOCX file into an InDesign file.

All of the instructions and command-line prompts that I am writing as examples are based on the assumption that you are following the folder structure that I outlined above.

Mac OS: Accessing the Pandoc Workspace folder via Terminal 

You will need to access the command line in order to convert your Markdown files. For macOS, this means launching the Terminal app (you’ll find it in Applications > Utilities).

Next, you need to specify your Pandoc Workspace folder. The easiest way to do this in Terminal is to type cd (don’t forget a space after cd), and then drag the Pandoc Workspace folder over the Terminal window and press the Return key. The cd in this command stands for change directory and when you drag a folder into the Terminal window, it will automatically enter that folder’s path into the command line for you. So this command just tells Terminal to change the current directory to the specified path.

You can verify that you are in the correct folder by typing ls into the Terminal window and pressing Return. The ls command means list files, Terminal will display a list of the files and folders that exist inside the Pandoc Workspace (Figure 12).

Figure 12. Listing files and folders in Terminal

Windows: Accessing the Pandoc Workspace folder via Command Prompt 

On Windows, the command-line utility is called Command Prompt. To access it, click the Start menu and type Command Prompt into the Search bar. Once you see the Command Prompt application in the search results, click it to open it.

You now need to specify your Pandoc Workspace folder. To do that, type cd (don’t forget a space after cd) followed by the path to your Pandoc Workspace folder. For example, if you created a folder named Pandoc Workspace in your Documents folder then your command will look like this: cd C:Users<username>Documents (replacing <username> with your actual username).

The cd in this command stands for change directory, so it tells your command-line utility to change the current directory to the specified path.

You can verify that you are in the correct folder by typing dir into the Command Prompt window and pressing Enter. The dir command tells Command Prompt to list all of the files and folders in the current directory, so you should see a list of the files and folders that exist inside the Pandoc workspace. Figure 13 is an example of what the output of the dir command looks like in the Command Prompt window.

Figure 13. Command Prompt window after accessing my Documents folder with the cd command and using the dir command

Converting Markdown to DOCX

Now that you know that you are inside of the Pandoc Workspace folder, you can use relative paths to access your documents. Let’s have a look at what a basic conversion command looks like and how it works. First, I’ll show you the full command to type, and then I’ll explain what each of the parts mean:

pandoc -d pandoc-utilities/?2docx.yml -s -o example-output.docx ­example-markdown.md

To begin, pandoc tells the command-line utility that this command should run the Pandoc utility.

Next, -d pandoc-utilities/2docx.yml states that you want your default settings (-d) to be the settings specified in the 2docx.yml file, found in the pandoc-­utilities folder.

Then, -s lets Pandoc know that you want to produce a standalone document that is valid without relying on any other documents.

The phrase -o example-output.docx specifies your output document. The -o stands for output, and the file path that you enter directly after it is where Pandoc will save the document that it produces.

Finally, example-markdown.md is the name of your input file. You simply need a file name since you used the cd command to change the directory to the Pandoc Workspace folder (assuming that the Markdown file is at the top level of your Pandoc Workspace folder). If the file existed elsewhere on my system, I would need to enter the full file path here.

Figure 14 shows what the command looks like when it’s typed into Terminal on macOS.

Figure 14. This is what the command looks like when it’s typed into Terminal (macOS).

Now that you’ve had a look at the command that you’ll be using, execute it by typing it in your command-line utility and pressing the Return key (macOS) or Enter key (Windows).

A fraction of a second after pressing the Return or Enter key, you will see your DOCX file appear in the same folder as your Markdown file! Figure 15 shows what my Markdown file looks like compared to my Word file.

Figure 15. The source Markdown file compared to the output Word file

You can find both of these documents in the downloadable files for this article.

Placing the DOCX File in an InDesign Document

At last, it’s time to import your content into an InDesign document! To do this, go to InDesign and create a new document, making sure that the Primary Text Frame option is turned on (Figure 16). Enabling this option will make InDesign insert as many pages as needed when you place the Word document. This is especially important when placing a long Word document.

Figure 16. Having the Primary Text Frame option enabled when you create your document will ensure that extra InDesign pages are automatically inserted to fit all of the content from your Word document.

Once your new document is open, choose File > Place.

In the dialog box, navigate to the Word document that you created, choose it, and click Open. Now click the Primary Text Frame on a page in your InDesign document, and you should see the text frame get filled with styled content from your Word document (Figure 17).

Figure 17. The InDesign document with styled text

Notice that you now have several new paragraph styles in your InDesign document. These new paragraph styles are all imported from your Word document and they can now be altered as you see fit. (Alternatively, if you already have an InDesign document that contains styles named exactly the same as the Word document, InDesign will use those instead.)

It’s worth noting that DOCX and ICML are not Pandoc’s only output formats; it is capable of taking dozens of file types as input and converting them to dozens more. You can find a complete list of Pandoc’s input and output formats at pandoc.org, as well as extensive documentation that goes into much more detail than I could here.

Making Your Mark

While this process will probably take a bit of trial and error to get down, it will certainly be worth it in the end, especially if you need to convert many files. It’s not hard to see how you could create a workflow process using this system that could make lightning-fast document conversions and open up a whole new avenue for authoring content destined for InDesign.

Special thanks to Leonard Rosenthol and Jeff Carlson for contributing their expertise to this article. 

Bookmark
Please login to bookmark Close

Not a member yet?

Get unlimited access to articles and member-only resources with a CreativePro membership.

Become a Member

Comments (22)

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Courtenay Ennis

    Update: It’s WORKING! Here are the couple details that enabled me to get this working in Win10:

    – the /? part of the command line instruction was not necessary for me and probably led to conversion not working.

    – I think opening the style-reference.docx file in Word and clicking ‘enable editing’ from the ‘This file was downloaded from the internet so editing and saving is locked’ or whatever message may have been crucial.

    Ahhh, soo excited to move forward with this workflow!

    Thanks Jeremy for the article, and the ongoing thoughts and support.

    1. Jeremy Howard

      Hey Courtenay,

      I apologize for not being able to engage more during this process, it has been a very hectic few weeks. I am glad to hear that you got this working, it didn’t even occur to me that Word would have that kind of restriction on the document, excellent sleuthing!

  2. Courtenay Ennis

    Hi Jeremy,

    Soo, progress? I’m able to produce new errors, that may indicate I’m getting a bit further?

    Here’s what I’m getting now:

    My Command (Win10): …Pandoc Workspace>pandoc -d pandoc-utilities/?/2docx.yml -s -o example-output.docx -sample-2.md
    Unknown option -a.
    Unknown option -m.
    Unknown option -l.
    Unknown option -e.
    Unknown option –2.md.
    Try pandoc –help for more information.

    I get this message in Windows regardless of if I include the /?/ preceding the 2docx.yml or not, and in both command line and powershell.

    I’ve tried quickly searching the pandoc documentation for what these unknown options (-a, -m etc.) even are and did not find anything.

    Thanks again for any thoughts. Is there any chance you’re working with slightly different files than what are posted to the article link? Could you dropbox me the exact pandoc-workspace files you’re working with (or any ideas?)

    Thanks,
    Courtenay

    1. Courtenay Ennis

      Quick update / clarification: I tried both /?/ and /?. Realizing I need to stick to /?, but I keep getting the ‘openBinaryFile: does not exist’ error when I do so.

  3. Courtenay Ennis

    Update: I just tried with a freshly installed PanDoc and article files on MacOS, and same error. I think there may be an error in the demo files?

    Mod: Apologies if this is too many, too long comments, feel free to direct me to any policies I need to know about or remove any unwanted posts, but… I’m just trying to follow the article’s instructions at the simplest level, and I feel I have enough code awareness to do so… but it’s not working, and hopefully that is valuable feedback (even if CreativePro prefers to take these down, which I’m fine with)?

    Here is the printout of the error on MacOS:

    Courtenays-MacBook-Pro:Pandoc-Workspace courtenayennis$ ls
    images sample-2.docx
    pandoc-utilities sample-2.md

    Courtenays-MacBook-Pro:Pandoc-Workspace courtenayennis$ pandoc -d pandoc-utilities/?2docx.yml -s -o example-output.docx ­sample-2.md

    pandoc: pandoc-utilities/?2docx.yml: openBinaryFile: does not exist (No such file or directory)

    Also *should help*–I don’t think Terminal likes there being a space in the ‘Pandoc Workspace’ folder–I think it tries to run Pandoc (again) when it sees the first word? When I changed folder name to ‘Pandoc-Workspace’ I got further. (Windows seems to not care.)

    1. Jeremy Howard

      I just noticed that the site removes backslashes from the text… there should be a backslash between the “?” and the “2docx.yml” parts of the path.

      1. Courtenay Ennis

        Thanks so much for the troubleshooting help, Jeremy. I think this backslash caveat might be the insight I needed.

    2. Jeremy Howard

      I am curious about the “?” in your file path: pandoc-utilities/?2docx.yml – where si that coming from? or do you know? I have tested this on Windows 10 and didn’t encounter any issues.

      As far as the space in the “Pandoc Workspace” folder name; if the path has spaces in it then you can either surround it with single quotes or escape the space character by typing a “” before it.

      ‘Pandoc Workspace’ or Pandoc Workspace

      1. Jeremy Howard

        Scratch that, on Windows 10, the space does not need to be escaped. I just accessed my Pandoc Workspace with:

        cd C:UsersHowarDocumentsPandoc Workspace

        Then I checked to make sure I was in the proper location by typing:

        dir

        That returned this list of folders and files:

        03/23/2021 09:30 PM .
        03/23/2021 09:30 PM ..
        03/19/2021 06:51 PM 2,402 Demo Markdown File.md
        03/19/2021 06:42 PM 28,822 example-output.docx
        03/19/2021 06:09 PM images
        03/19/2021 06:42 PM pandoc-utilities
        2 File(s) 31,224 bytes
        4 Dir(s) 703,233,867,776 bytes free

        From there, I used the command:

        pandoc -d pandoc-utilities/?2docx.yml -s -o example-output.docx ­example-markdown.md

      2. Jeremy Howard

        These examples are from Command Prompt, not Powershell

  4. Courtenay Ennis

    Hi Jeremy– has this been tested on Windows 10?

    I’ve tried command prompt as well, and going back to all unaltered files from the article: same 2docx.yml, style-reference.docx and ‘sample-2.md’ file from the article. Same error:

    pandoc: pandoc-utilities/?2docx.yml: openBinaryFile: invalid argument (Invalid argument)

    I’ll try this on Mac, next, but Windows seems to be a no-go, for now.

    I’ll also try to learn about the error, but am way over my head with real code (although I do have some recent command prompt / power shell experience)

  5. Courtenay Ennis

    Okay, I know command line code is ruthlessly unforgiving, but I’ve tried with several style-reference.docx files, including the sample one from the article files, and I keep getting this message:

    pandoc.exe: pandoc-utilities/?2docx.yml: openBinaryFile: invalid argument (Invalid argument)

    Any idea what might be causing this?

    Here is my command string: pandoc -d pandoc-utilities/?2docx.yml -s -o CE test docx output.docx MD Sample with all styles for conversion check plus Grant.md

    Is it the spaces in the filenames? Any ideas?

    1. Courtenay Ennis

      p.s. here’s my Pandoc Workspace folder dir output:

      Directory: C:UsersCourtenayDocumentsMarkdown to docx PanDoc reference files for InDesignPandoc Workspace

      Mode LastWriteTime Length Name
      —- ————- —— —-
      d—- 2021-07-22 2:35 PM images
      d—- 2021-07-22 2:39 PM pandoc-utilities
      -a— 2021-07-22 2:32 PM 2883 MD Sample with all styles for conversion check plus Grant.md

      I’ve since tried short filenames with no spaces, just dashes, and still same error.

      My 2docx.yml file seems to be correctly pointing to the style-reference.docx file…

      This is all on Windows 10 in PowerShell 7, if that might be a factor.

  6. Courtenay Ennis

    Jeremy, re ‘Be sure to stick to the default styles in the DOCX document when creating your styles because those styles are the ones that Pandoc will use when it makes the conversion’– I want to make sure I understand: *Which* DOCX document? Or do you just mean ‘don’t style the text’ (because that’s pointless), only create / name / edit styles in the document’s style set, as these are what pandoc converts the Markdown to?

    If it’s the a specific DOCX–do you mean your example file, specifically?

    Conversely, if it’s ‘whatever DOCX reference I create,’ how does PanDoc know how to map things, unless I stick to some very strict style names (and where is the list for this)?

    Maybe I’m overthinking this and just need to try it, but… I’ve looked through your docx reference file and the other files in your PanDoc Working Folders and I can’t understand how PanDoc knows how to map the Markdown styling to the specific Word styles in your reference doc, aside from the ‘RedText’ style and the Headers and Body text–or do all the names in your style-reference.docx conform to some important standard names for PanDoc’s Markdown parsing that I need to be aware of?

    i.e. If I name my own styles in Word, how do I get PanDoc to map the Markdown to the Word Styles?

    Where does the deeper ‘reference’ live for how it names the Markdown and/or Word style mapping, in your case? Is it in PanDoc itself, or a .yml or .lua file, or what?

    Sorry if I ask the same or very similar questions a few times, but I hope I was clear enough, and huge apologies if you covered this and I missed this (or there’s some magic I don’t understand that makes this all moot?).

    I’m so grateful for this article, as I really want Markdown and PanDoc to be my workflow. I’m in a bit over my head, but I’m determined to learn this, so huge thanks again for the article and any further clarification you can provide.

    1. Courtenay Ennis

      Update for anyone reading: I think I found the ‘deeper reference’ paramaters for Markdown to DOCX accepted style names, buried in a million lines of PanDoc documentation.

      Go here, then scroll down a while to a ‘docx’ heading for a deeper explanation of how to create a docx style reference file, and and a list of style names to use: https://pandoc.org/MANUAL.html#options-affecting-specific-writers

      1. Courtenay Ennis

        Here’s a paste of what this part of the PanDoc documentation says:

        Docx
        For best results, the reference docx should be a modified version of a docx file produced using pandoc. The contents of the reference docx are ignored, but its stylesheets and document properties (including margins, page size, header, and footer) are used in the new docx. If no reference docx is specified on the command line, pandoc will look for a file reference.docx in the user data directory (see –data-dir). If this is not found either, sensible defaults will be used.

        To produce a custom reference.docx, first get a copy of the default reference.docx: pandoc -o custom-reference.docx –print-default-data-file reference.docx. Then open custom-reference.docx in Word, modify the styles as you wish, and save the file. For best results, do not make changes to this file other than modifying the styles used by pandoc:

        *Paragraph styles:*

        Normal
        Body Text
        First Paragraph
        Compact
        Title
        Subtitle
        Author
        Date
        Abstract
        Bibliography
        Heading 1
        Heading 2
        Heading 3
        Heading 4
        Heading 5
        Heading 6
        Heading 7
        Heading 8
        Heading 9
        Block Text
        Footnote Text
        Definition Term
        Definition
        Caption
        Table Caption
        Image Caption
        Figure
        Captioned Figure
        TOC Heading

        *Character styles:*

        Default Paragraph Font
        Body Text Char
        Verbatim Char
        Footnote Reference
        Hyperlink
        Section Number

        *Table style:*

        Table

  7. Courtenay Ennis

    Jeremy, first, thanks for this clear, very helpful article.

    I’m super-excited about writing in MD and getting this to auto-format (roughly, at least) in InD.

    I’m currently trying to figure out this workflow with ICML files, and am wondering if there is a way to ‘map'(?) MD default style names to new names. e.g. Have H1 in Markdown ‘map’ to an InDesign/InCopy para style nameed e.g. ‘H1 NHG Black’) via… not sure, but maybe via the reference file? Or is it crucial that I only use matching style names?

    I’d also love to keep any verbose mapping workarounds in the reference file (or further downstream?), so the MD remains as human-readable as possible. e.g. is there a less verbose way to tag character styles than the long, codey, human-reading-interrupting {custom-style=’Body Small Caps’} in the MD file that you know of? (Admittedly paragraph styles are a bit less disrupting to skip the code when reading MD, but… how tiny can we get these instructions?)

    Or is the answer not PanDoc and reference files, but a GREP or other script (kinda just beginning with advanced InD, here) that looks at the MD style names that would get added to InD and just convert a list of them to other styles, all at once?

    I’d really like to open these MD-to-DOCX or ICML files into a an InD template with the styles already defined in InD, rather than let Word or InCopy define the details of the para styles.

    Any thoughts or further places to direct me re this? Either way, thanks again for the super-helpful article!

    1. Jeremy Howard

      Hello Courtenay, I am glad that you enjoyed the article!

      You will be glad to hear that there is a way to do what you are trying to do using native InDesign tools. Open your target document in InDesign and go to File>Place. Navigate to the Word document that you want to place and select it.

      Before you hit open, make sure that the checkbox next to “Show import options” is selected. Click “Open” once the box is ticked on. This will open the Import Options dialog.

      Way down at the very bottom of this dialog is a radio button that is labeled “Customize Style Import”, click that.

      Now click on the “Style Mapping” button to open the Style Mapping dialog. From here, you can map the styles from your Word document to the styles of your choosing in your InDesign document.

      Once you have mapped all of your styles, click “OK” to exit the Style Mapping dialog and return to the Import Options.

      Now you can click the “Save Preset” button in the top right-hand corner of the Import Options dialog. This will allow you to save the mapping that you just configured to so that you can easily choose it again in the future!

      Pretty nifty eh?

      1. Courtenay Ennis

        Thanks so much, Jeremy! Yes. This is super-nifty and exactly what I need.

        I now to have a single template with several masters for different content types, and several style mapping presets saved, depending on which type of template I’m pasting into.

        Thanks again!
        Courtenay

  8. Joern Kobes

    Well, good ideas. I use Markdown for Pre-Editing (small, clean code) and directly convert markdown files from Pandoc to ICML (InCopy) for placing in InDesign..

    1. Jeremy Howard

      I had considered explaining the process of Markddown to ICML using Pandoc but decided against it in the end. There are two reasons I opted to show this docx workflow instead of the icml workflow; images and alt text. Neither of which are possible to place when using the icml format.

      1. Courtenay Ennis

        I was really wondering about this, too! Thanks for explaining.