LoginSignup
283
282

More than 5 years have passed since last update.

MarkdownをWord形式(docx)に変換する

Last updated at Posted at 2014-10-17

考えを整理しながらドキュメントを書くのにMarkdownが便利ですが、資料を印刷して持ってきてとか言われると困ったりします。
そんな時にPandocを使ってdocxなどの形式に変換して印刷すると便利です。(PDFにも出来ますが、フォントサイズなどの微調整も出来るのでdocxにすることが多いです)

Pandoc

pandocは、Haskell製のドキュメント変換ツールです。
対応している形式などは以下を参照してください。

インストール

インストールは以下を参考にしてください。PDFへ変換するには別途依存するライブラリを入れる必要があります。

MacとWindows向けにはインストーラが提供されているので、それを使ってインストールすると楽です。

利用方法

以下のsample.mdをWord形式に変換してみます。

sample.md
A First Level Header
====================

A Second Level Header
---------------------

Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.

The quick brown fox jumped over the lazy
dog's back.

### Header 3

> This is a blockquote.
> 
> This is the second paragraph in the blockquote.
>
> ## This is an H2 in a blockquote


Some of these words *are emphasized*.
Some of these words _are emphasized also_.

Use two asterisks for **strong emphasis**.
Or, if you prefer, __use two underscores instead__.


*   Candy.
*   Gum.
*   Booze.

1.  Red
2.  Green
3.  Blue

*   A list item.

    With multiple paragraphs.

*   Another item in the list.

This is an [example link](http://example.com/).

```ruby
 def hello
  puts "Hello, world!"
end
\```

---

自分の環境がWindowsなので、PowerShellから以下のように実行すると

PS C:\Users\tenten0213\Desktop> pandoc .\sample.md -t docx -o sample.docx

以下のようなWordファイルが作成されます。

sample.jpg

便利。

283
282
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
283
282