Markdown to DOCX

There are lots of people here who are Markdown users/fans.

I’m hoping you guys can solve my one barrier to Markdown:
Converting from Markdown to DOCX, with custom styles.

Basically I want to convert Markdown into a specifically styled DOCX document, and I want to specify styles myself.

Things I tried

  • iA Writer custom templates: pretty easy to make. Just CSS/HTML. But they don’t work when exporting to DOCX, the styles just convert to Word’s default.
  • pandoc: same problem as above

My solution for now has been using Scrivener to convert from RTF to custom DOCX. But this requires writing in RTF. I don’t mind, but some people have pointed out Markdown’s advantages.

Bonus/nice-to-haves:

  • allows me to type LaTeX inline with the MD document and convert that too.
  • free

Platforms I’m On: iPadOS, iOS, macOS

Any and all help welcome.

1 Like

Looks like you can do it with R Markdown. I don’t think there are any R options for ixOS though.

Will style sheets in Ulysses work for you. Large library available or make your own.

https://ulysses.app/styles/pdf-docx-styles

https://ulysses.app/tutorials/export/

2 Likes

@JohnAtl thanks! I’ll be looking into that.

@RichardC no, Ulysses is subscription. Can’t use it.

Won’t use :slightly_smiling_face: 1234567 89101113

2 Likes

no, it is “can’t” use. too expensive.

1 Like

That’s a nice handholding tutorial on export style sheets. Better than anything I’ve seen online, actually.

Have you tried pandoc’s reference-doc parameter?

1 Like

Okay, I’ll ask the dumb question - why don’t you just change your default Style settings in Word, so that when you export, it automatically picks up the formatting you want?

If it’s formatting that you don’t want as your defaults in Word, you could:

  1. customize the defaults in Word all you wanted
  2. quit word and all your office applications
  3. Go into your templates folder and save normal.dotm as something like forExport.dotm
  4. Lauch Word again, which would then generate a fresh normal.dotm
  5. Anytime you need to export to that template, quit word, rename forExport.dotm to normal.dotm, rerun word, and then do your export.

I know it’s not an ideal workaround, but it’s an option?

2 Likes

Have you tried pandoc’s reference-doc parameter?

Exactly what I was going to suggest. It’s easy to set up and works quite well.