LoginSignup
19

More than 5 years have passed since last update.

markdownをpptxで変換

Posted at

Typoraというmarkdown editorがあるんですがそこでWordファイルでexportをすると

「pandocを設置してください」

というポップアップが出ます。

pandocの設置をするとWordファイルでよく変換ができます。

Wordファイルはこれでいいけど、markdownをpptxで変換ができるかなと思ってpandocサイトを調べてみました。

[https://pandoc.org/MANUAL.html]

やっぱりpptxの変換機能がありました。まず簡単に基本ファイルを変換してみました。

basic.png

この結果でそのまま使えるかはちょっと疑問が起きます。場合によって様々なテンプレがあるのでこれではちょっとまずいですね。

マニュアルをよく見たらこんなoptionが発見できます。

--reference-doc=Filename

reference-docはドキュメントの生成時テンプレになるファイルです。マニュアルではdocsまたodtファイルしか書いてないですが、pptxもできます。

PowerPoint

The specific requirement is that the template should contain the following four layouts as its first four layouts:

  1. Title Slide
  2. Title and Content
  3. Section Header
  4. Two Content

テンプレには最小4個のスライドが要るしタイトル、タイトルとコンテンツ、セクション・ヘッダ、コンテンツ2個がそのものです。それを従うpptxファイルを「デザイン」タブから用意します。(自作も構いませえん)

reference.png

  • ファイル名:ref.pptx
    • 1番目:title slide
    • 2番目:section header
    • 3番目:title + content
    • 4番目:title + 2contets

これをpptxでそのままダウンして(reference.pptx)mdファイルで変換してみました。

mdファイル(test.md)

% Habits
% John Doe
% March 22, 2005
# In the morning
## Getting up
- Turn off alarm
- Get out of bed
## Breakfast
- Eat eggs
- Drink coffee
# In the evening
## Dinner
- Eat spaghetti
- Drink wine

コマンドは

pandoc test.md -f markdown -s -o test.pptx --reference-doc=ref.pptx

結果ファイルは以下のように作られます。

finalfile.png

以前ではmarpを作ってスライドを作成しましたがpptxの変換を支援しないししテンプレの2個しかないので不便でした。でもpandocを使うとpptxを100%まではないですがそれなりにmarkdownファイルをpptxで共有することができます。

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
19