How to convert Markdown to Shun manuscript format

Notes about writing manuscripts in Markdown are after the conversion tutorials.

I love Markdown. I love it so much that I’ve adapted my whole workflow around it! From writing fiction podcast scripts to drafting blog posts, it’s just pure plain text, and I love it because it’s so portable and universal.

I wanted to write Markdown manuscripts and then convert them to Shun format industry standard documents. In short, I’ve figured out how to do it, but it’s a very involved process. If just opening up Word or otherwise works for you, do that. Seriously, don’t try to adopt this workflow unless you really, really, love writing in Markdown as much as I do.

Because I’m a Windows user, the below is going to be Windows focused.

I write all my stuff in Markdown and then convert it to other formats using Pandoc. This way, my work is very portable, and I don’t have to transfer every single Macro to new computers. Text files are much smaller than document files so they don’t take up space in my cloud drives.

Requirements.

The below, though, will definitely take some time to set up. It requires you knowing Markdown basics, being comfortable with using the command line and downloading things from the internet and installing programs, as well as working with styles and editing styles in Microsoft Word.

JAWS tutorials for Microsoft Office are here and NVDA tutorials for Word are here

For the command line, we’re going to use PowerShell for this because it’s more versatile.

If you’d rather use templates for Word instead, Shun made templates and I made modern versions of his templates for Word

Let’s get started!

Use my Pandoc templates instead of making your own

Download my Pandoc reference templates here or make your own below.

If you want one command that will download all of my templates, use the below command to download Pandoc, make a Pandoc data folder, then download all the pre made templates into that folder.

winget install JohnMacFarlane.Pandoc; New-Item -Path "$env:APPDATA" -Name "pandoc" -ItemType Directory; CD $env:APPDATA\pandoc; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/reference.docx' -OutFile ./reference.docx; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/PandocReferenceWithHeadingsCreatingNewPages.docx' -OutFile ./PandocReferenceWithHeadingsCreatingNewPages.docx; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/reference.odt' -OutFile ./reference.odt; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/df487a997941a0b299a003edd2c24a3fc81e45b8/Pandoc%20templates/PandocBookReferenceWithoutHeadingsAsNewPages.docx' -OutFile ./PandocBookReferenceWithoutHeadingsAsNewPages.docx

After running the above command, you should be able to just convert the documents without having to make templates.

To use any other template in this directory other than the ones named reference, use the below command as an example, making sure to replace the custom name with the template name. If it has spaces in it, put the name in quotes.

pandoc -s File.txt --reference-doc=$env:APPDATA\pandoc/CustomeName.docx -o File.docx

Otherwise, do it all yourself below!

Downloading Pandoc.

Download Pandoc for your operating system and install it.

Alternatively, you can run this command in Windows Powershell to install Pandoc.

winget install -e --id JohnMacFarlane.Pandoc

If you want to just download the nessisary files, use the below PowerShell command.

winget download -e --id JohnMacFarlane.Pandoc

After you install Pandoc, restart your computer. Now, you should be good to go.

Now, we’re going to split this up into two sections. A DIY template that you create, that you can use anywhere, and a preconfigured script someone else made. The DIY method is good for those that don’t want to rely on third party developers.

DIY manuscript conversion.

This method requires a lot of setting up, but it’s going to be worth it in the end. You will only need to set this up once. After you set it up, you can just make copies of your reference document.

This other tutorial has reference files for LibreOffice

First, get acquainted with Pandocs commands with this getting started page. All commands start with -Pandoc, and are usually one line for this tutorial.

The first thing we’re going to need to do is make a template. When exporting into a Word format, Pandoc references templates so it knows how to style your outputs.

It can’t reference any random template, though. It needs to reference a template based on its structure. This is why we need to make our own template.

Pre made Pandoc templates.

Download my Pandoc reference templates here or make your own below.

If you want one command that will download all of my templates, use the below command to download Pandoc, make a Pandoc data folder, then download all the pre made templates into that folder.

winget install JohnMacFarlane.Pandoc; New-Item -Path "$env:APPDATA" -Name "pandoc" -ItemType Directory; CD $env:APPDATA\pandoc; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/reference.docx' -OutFile ./reference.docx; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/PandocReferenceWithHeadingsCreatingNewPages.docx' -OutFile ./PandocReferenceWithHeadingsCreatingNewPages.docx; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/reference.odt' -OutFile ./reference.odt; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/df487a997941a0b299a003edd2c24a3fc81e45b8/Pandoc%20templates/PandocBookReferenceWithoutHeadingsAsNewPages.docx' -OutFile ./PandocBookReferenceWithoutHeadingsAsNewPages.docx

After running the above command, you should be able to just convert the documents without having to make templates.

To use any other template in this directory other than the ones named reference, use the below command as an example, making sure to replace the custom name with the template name. If it has spaces in it, put the name in quotes.

pandoc -s File.txt --reference-doc=$env:APPDATA\pandoc/CustomeName.docx -o File.docx

Navigating to make your reference template.

Download Pandoc templates I made here or make your own, below. After downloading them, move the templates into your data directory folder, change the names to something simple, and just convert documents!

Download my Pandoc reference templates here or make your own below.

If you want one command that will download all of my templates, use the below command to download Pandoc, make a Pandoc data folder, then download all the pre made templates into that folder.

winget install JohnMacFarlane.Pandoc; New-Item -Path "$env:APPDATA" -Name "pandoc" -ItemType Directory; CD $env:APPDATA\pandoc; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/reference.docx' -OutFile ./reference.docx; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/PandocReferenceWithHeadingsCreatingNewPages.docx' -OutFile ./PandocReferenceWithHeadingsCreatingNewPages.docx; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/main/Pandoc%20templates/reference.odt' -OutFile ./reference.odt; Invoke-WebRequest 'https://github.com/rkingett/writertools/raw/df487a997941a0b299a003edd2c24a3fc81e45b8/Pandoc%20templates/PandocBookReferenceWithoutHeadingsAsNewPages.docx' -OutFile ./PandocBookReferenceWithoutHeadingsAsNewPages.docx

After running the above command, you should be able to just convert the documents without having to make templates.

To use any other template in this directory other than the ones named reference, use the below command as an example, making sure to replace the custom name with the template name. If it has spaces in it, put the name in quotes.

pandoc -s File.txt --reference-doc=$env:APPDATA\pandoc/CustomeName.docx -o File.docx

If you don’t like my templates, you can make your own, below.

If you’d like one Powershell command that makes a reference document after making a user data directory, the below command will first make a user data directory, then go into the directory, then make a reference file.

New-Item -Path "$env:APPDATA" -Name "pandoc" -ItemType Directory; CD CD $env:APPDATA\pandoc; pandoc -o reference.docx --print-default-data-file reference.docx

You can also do this step by step below.

In order for this to work, we need to make a Pandoc User Data directory folder. after the Pandoc installation.

Once Pandoc is installed,

Open up, Run, by pressing, Windows key plus R.

After the Run dialog opens, put this.

%APPDATA%

Press enter.

Press, Control, Shift, N, to make a new folder inside of this AppData folder. Call it Pandoc

Now, open up Powershell and the below command will first navigate to your Pandoc directory you just created, then make a reference document, all with one command.

CD $env:APPDATA\pandoc; pandoc -o reference.docx --print-default-data-file reference.docx

Or, open up Powershell in this user data directory with Windows Explorer.

Open the run dialog, then type,

%APPDATA%\pandoc

Next, to open Powershell with windows explorer, press, Alt D, Delta, then type, Powershell, all one word, and then hit enter.

After opening up powershell above or doing it first then navigate to where your Pandoc user data folder is or any directory where you want to store templates. To navigate to the Pandoc user data folder quickly, you’d do this,

CD $env:APPDATA\pandoc

CD in command line speak means, change directory. If you have an external hard drive, you’d first enter that external hard drive by typing,

CD DRIVELETTER, where DRIVELETTER is the letter of your actual drive.

If you keep everything on your computer, you need to enter the full path after the, CD, command. For example, to get to the desktop, you could use,

CD $home\Desktop

Alternatively, you can open up a powershell window at any location from Windows explorer.

To open powershell at any location, navigate to the folder you want to store your templates and manuscripts in. It works best if everything is in one folder, but we’ll worry about that later.

In the address bar, type,

Powershell

And hit enter. No spaces should be between power, and shell.

Now that powershell is open where you want to have it, Let’s make a reference document.

Making a reference document.

If you downloaded my Pandoc reference documents, you can just use those instead of making your own.

Download my Pandoc reference templates here or make your own below.

After downloading my Pandoc templates, move them to the user data directory folder, then rename them to something easy to type.

To make Pandoc use a default template you downloaded every time, rename the template to,

reference.docx

To use any template in this directory, use the below command as an example, making sure to replace the custom name with the template name. If it has spaces in it, put the name in quotes.

pandoc -s File.txt --reference-doc=$env:APPDATA\pandoc/CustomeName.docx -o File.docx

To make a reference document, you’d type,

pandoc -o reference.docx --print-default-data-file reference.docx

To make a LibreOffice reference document,

pandoc -o reference.odt --print-default-data-file reference.odt

After your reference document is created, open up your reference document in Word or LibreOffice Writer.

Editing styles in Microsoft Word.

Use this guide to edit the, first paragraph style, and the, body text style, styles so that the  line spacing is double, first line is indented 0.5 inches, and the font is 12 PT, Times New Roman.

The easiest way to edit the styles with a keyboard is to do the following.

After your reference document is open in word,

Press control+alt+shift+s to open the "Styles" toolbar. The styles you need to change are the, body text, and the first paragraph, styles.

if your cursor is on a style in the document, control+alt+shift+s to open the "Styles" toolbar should have you landing on that style in the styles toolbar.

Press the applications key, then hit enter on Modify or tab to the Modify button.

Once the Modify style dialog box is open, tab to the font ComboBox. Change it to Times New Roman. Change the size to size 12.

Tab until you hear, format menu button. Press enter, go down to paragraph, then press enter.

In this new dialog box, tab until you hear, special, ComboBox. Change the ComboBox to, first line.

When the ComboBox has been changed to first line, tab, and enter 0.5.

One more step! Now tab until you hear, line spacing. Change that to double.

Press okay, or apply, but pressing Okay is fine here. Press okay again to save and close out of the first style dialog box.

After editing the styles, save your edited reference document.

Editing styles in LibreOffice Writer.

I am a Word user more than a LibreOffice user but the below should be a decent guide on editing the style in the reference document.

To edit your LibreOffice styles for writer, do the following with the keyboard.

Learn about styles in Writer here. the important style types are the paragraph styles.

After your ODT reference file is created, open the reference file in LibreOffice Writer.

Press, Alt, P, Papa, to open the edit style dialog box.

At the top, you should see tabs. Pressing Control Tab to cycle through these should work but if it doesn’t work for you, shift tab until your screen reader focus lands on the tab row at the top.

Switch to the, indents and spacing, tab.

tab until you hear, First line: 0.00″

Change the numeral to 0.50. It should now say, First line: 0.50″

Tab until you hear, line spacing option pane ComboBox. Change it to double.

Apply the changes, and then save your reference document.

The font style and font size are already where they should be, but if you wanted to edit other styles to match your newly edited style, you can edit all styles by pressing F11.

If editing other styles, I’d change the, first line, style to match the edited paragraph style. If you don’t want to edit other styles, you can save the reference document and close LibreOffice.

After editing styles.

Now you just need to start converting because our modified reference document is in the User Data directory folder.

Now you have all files where you need them, we’re going to convert Markdown to Shun Manuscript format.

With your manuscript all in one text file or Markdown file, use the below command to convert your manuscript.

pandoc -s book.md --output KingettManuscript.docx

If your reference document is not in Pandoc User Data directory folder, then move it to the same folder as your book and use the command below.

pandoc -s ManuscriptName.md --reference-doc= refdoc.docx --output manuscript.docx

If you don’t want to specify a reference document every time, we need to make Pandoc use our modified reference template as the default template.

Changing default reference template for our DIY conversion.

If you would like one command to do everything, the below will navigate to your Pandoc Data folder and make a reference document, all with one command.

CD $home\appdata\Roaming\pandoc; pandoc -o reference.docx --print-default-data-file reference.docx

You can also navigate to your Pandoc User Data directory folder.

In the address bar, type, powershell, and press enter.

next, we make our reference document.

pandoc -o reference.docx --print-default-data-file reference.docx

edit the styles like before, making sure to change the body text style, and the first paragraph style, to 12 PT font, Times New Roman, Double line spacing, with the first line indented 0.5 inches.

After all styles are edited, save and close your reference document.

Now, you won’t need to specify the reference document every time, so your command will look like this,

pandoc -s ManuscriptName.md --output manuscript.docx

Below, I’ll show you how to convert and merge multiple files with our modified reference template.

Merging multiple files with your DIY template.

The easiest way I’ve found of doing this is to put your custom reference document in the User data directory so that Pandoc uses the document every time it converts to Docx.

To navigate to, and then, make a reference document in your Pandoc data directory, use the below command. The below will tell Powershell to go to your Pandoc data directory, then make a reference document.

CD $home\appdata\Roaming\pandoc; pandoc -o reference.docx --print-default-data-file reference.docx

Or navigate to where your Pandoc data directory folder is manually.

In the address bar, type, powershell, and press enter.

next, we make our reference document.

pandoc -o reference.docx --print-default-data-file reference.docx

edit the styles like before, making sure to change the body text style, and the first paragraph style, to 12 PT font, Times New Roman, Double line spacing, with the first line indented 0.5 inches.

After all styles are edited, save and close your reference document.

Now you can merge multiple files without having to specify a reference document every time.

If you want to split your chapters up into separate files, you need to specify each input file name, in order, so that it will merge all the files into one document.

Let’s say you have a folder called Book. Inside of that folder, you have text files. These text files need to be named sequentially. The easiest way I’ve found of doing this is to use the below Powershell command to rename all files in the directory by date created, then it will concatenate all text files after renaming them.

Get-ChildItem . | %{Rename-Item $ -NewName ('{0}{1}' -f $.LastWriteTime.toString("yyyyMMdd-hhmmss"), $_.Extension)}; pandoc (get-item *.txt).FullName -o final.docx

If you have a mixture of file types, the below command will concatenate all files in a folder.

Get-ChildItem . | %{Rename-Item $ -NewName ('{0}{1}' -f $.LastWriteTime.toString("yyyyMMdd-hhmmss"), $_.Extension)}; pandoc (Get-ChildItem .).FullName -o final.docx

You can also sequentially rename them yourself. I prefix all my names with 00, like this.

001 breakupscene

002 afterwards.

Then, in powershell, you would put the below.

pandoc (Get-ChildItem .).FullName --wrap=none -o final.txt

If you have a directory of other file types that you want to merge into one text file, use the below command.

pandoc (Get-ChildItem .).FullName --wrap=none -o final.txt

Alternatively, you can use the below command to rename all files in a directory sequentially by date, then concatenate, or merge, all the reorderd files in a directory. The below Powershell command will rename all files in a directory sequentially by date created and then merge them with Pandoc.

Get-ChildItem . | %{Rename-Item $ -NewName ('{0}{1}' -f $.LastWriteTime.toString("yyyyMMdd-hhmmss"), $_.Extension)}; pandoc (Get-ChildItem .).FullName -o final.docx

The semicolon in the above is intentional. The above command performs two commands one after the other.

Finally, alternatively, you can also list them one at a time. To list them all one at a time, make sure you specify each text file in the command. For example,

pandoc -s -o Book.docx ch1.md ch2.md ch3.md ch4.md ch5.md

Converting multiple files into Markdown.

Just in case you wanted to convert any directory of Docx files to Markdown, and the order doesn’t matter, use the below command after navigating to the directory containing the files in power shell.

gci -r -i *.docx |foreach{$md=$.directoryname+"\"+$.basename+".md";pandoc -f docx --wrap=none -s $_.name -o $md}

The above will make Markdown versions of your Docx files. It won’t merge all of them though, only make an MD version of your Docx files in the folder.

If you wanted to merge, or concatenate, all files in a directory with Powershell, make sure the files are named in sequential order.

If you want to rearrange and rename all files in a directory then merge them with Pandoc, use the below command, including the semicolon.

Get-ChildItem . | %{Rename-Item $ -NewName ('{0}{1}' -f $.LastWriteTime.toString("yyyyMMdd-hhmmss"), $_.Extension)}; pandoc (get-item .).FullName -o final.txt

I personally prefix all of mine like this, 00.

It reads like this.

001

002

003

After all files are where you need them to be, merge all files in powershell with this command.

pandoc (get-item .).FullName --wrap=none -o final.txt

If you wanted to convert all text files into the Shun DIY template we made earlier, use the below command in Powershell.

pandoc (get-item *.txt).FullName -o final.docx

Now, onto a script that will do all this for you!

Using a script.

This Pandoc script will do all the hard work for you!

First, download the latest script from this page.

To download the script, expand the, code, button, then click download as zip or download Master.

Extract the folder to a folder where you’ll remember it.

Open up powershell and then navigate to this folder, the unzipped script folder.

Alternatively, you can navigate there using Windows Explorer. Navigate to the folder and then type, powershell, in the address bar.

Inside this folder, you can change the test folder to work, or BookDraft, all one word, or anything you want. The simplest thing to do is just use the test folder to store your manuscripts and short stories.

Inside the test folder, you’ll find a short folder and long folder.

Go into each folder, open up each first MD file in notepad, and edit the YAML data at the top. You’ll only need to do this once. Change all contact information to your own contact information.

After you change your contact information and delete the sample text below the YAML data, save the documents and then close the files after deleting all the sample text below the YAML data.

Now, all you need is the below commands. You can even split your book up into separate documents and merge them all with one command.

All of the below commands will output your output files to your desktop.

To convert single files, you’d use the command below, making sure to tell Pandoc where your manuscript file is.

If you wrote everything in one long file, use the below command, replacing name’s as needed.

.\bin\md2short.ps1 -overwrite -modern -output $env:USERPROFILE/Desktop/Book.docx './test/long/Book.md'

If you created a short story, use the below command, replacing name’s as needed.

.\bin\md2short.ps1 -overwrite -modern -output $env:USERPROFILE/Desktop/ShortStory.docx './test/short/story.md'

With this script, you can merge all files in a folder in order. When saving files to a folder, or renaming files, make sure to save the files with sequential numbers. Like this,

001 intro.

002 Start.

003 END.

The important thing is to have the numbers at the beginning the same length, and make sure they are in sequential order.

After all chapters have name’s in sequential order, use the below code.

.\bin\md2long.ps1 -overwrite -modern -output $env:USERPROFILE/Desktop/Book.docx './test/long/*.md'

Convert documents to plain text.

If you wanted to convert a file to plain text and or markdown, use the below command. Even if you type Markdown syntax into a plain text file without the MD extension, Pandoc will still convert it correctly later.

pandoc -s draft.docx --output draft.md --wrap=none

Working with track changes in plain text.

There might be cases where you need to work with track changes but you want track changes to work in your text editor.

I explain in greater detail about this in my plain text workflow explanation but if you just want some commands to use, use the below.

pandoc -s draft.docx --output draft.md --wrap=none --track-changes=all

The above command prints all suggestions and comments, but does not accept or reject anything.

If I want to accept everything and just read the changed output as plain text, I use,

pandoc -s draft.docx --output draft.md --wrap=none --track-changes=accept

The above accept command doesn’t include comments in the output so if I want to read comments as plain text but exclude all the suggestions, I accept all suggested changes in Microsoft Word by pressing, accept all and stop tracking, in the document. I then save and close the document. With Pandoc, I then put,

pandoc -s draft.docx --output draft.md --wrap=none --track-changes=all

Some notes about writing manuscripts in Markdown.

Your chapters are going to be headings, so, if you want to make a new chapter heading, you’d just write, either of the below depending on your preference.

If you want to make all chapters a heading level 1, use one #

If you want chapters to be heading level 2, use two ##

For example, if you wanted all chapters to be level 1 headings, you’d write,

# Chapter 1.

If you wanted all chapters to be heading 2, you would write it like this,

## chapter 1.

To automatically convert "dumb" quotes into "smart" quotes, as well as turning fake em-dashes — the kind made with two hyphens — into real em-dashes (—), and turning three periods (…) into ellipse, add the below to any of the above commands for outputting books and other documents,

--smart

I hope this helped someone! It can take a lot to set up, but when you do get it set up, you can just write in plain text, and convert it to a beautiful, formatted, document in seconds!

Thanks for reading, support me financially and or Send your reply link via email so it can appear on my reply page.