使用landslide將 markdown 做成 PPT

使用 markdown 寫 PPT

Landslide是基於Google的html5slides的一個Slide生成工具,可將markdown、ReST 或者 textile文件轉化成HTML5的slide。

Landslide 基於 Python 開發,最大的優點就是簡潔,從安裝到編寫,到生成的 slides 風格都十分簡潔。整個過程,用戶只需要懂 Markdown 語法就可以.

該轉化支持內聯模式,即生成一個具有完整功能的HTML文件,將依賴的css等東西放入其中,很容易用來分享。

項目地址: https://github.com/adamzap/landslide
作者寫的幾個例子: https://github.com/adamzap/landslide/tree/master/examples

一. 安裝 使用

安裝:

--- 安裝
$ pip install landslide

--- 使用
$ landslide file.md -d name_you_like.html

幻燈片播放快捷鍵:

--- PPT 支持的快捷鍵

h:      展示幫助
← →:    上/下一張幻燈片
t:     顯示目錄
ESC:    展示PPT總覽
n:      顯示當前是第幾張幻燈片
b:      屏幕全黑
e:      使當前幻燈片最大化
2:      展示 幻燈片 筆記, 指定的 .notes 宏裏的內容
3:      展示僞3D效果
c:      取消顯示前後幻燈片預覽,只顯示當前幻燈片
S:      展示每個幻燈片文件的 源地址 鏈接.

高級用法:

--- 設置自定義 目的文件
$ landslide slides.md -d /path/to/dest/slide.html

--- 目錄
$ landslide slides/

--- 在直接打印結果
$ landslide slides.md -o | tidy

--- 使用其他主題
$ landslide slides.md -t mytheme
$ landslide slides.md -t /path/to/theme/dir

--- copy the whole theme directory to your presentation one by passing the --copy-theme option to the landslide command
$ landslide slides.md -t /path/to/theme/dir --copy-theme

--- 內嵌 Base-64 編碼 圖片
$ landslide slides.md -i

--- 導出爲 pdf
$ landslide slides.md -d presentation.pdf

--- If you intend to publish your HTML presentation online, you'll have to use the --relative option, as well as the --copy-theme one to have all asset links relative to the root of your presentation;
$ landslide slides.md --relative --copy-theme

查看幫助

--- 幫助
$ landslide --help

    Usage: landslide [options] input.md ...

    Generates an HTML5 or PDF slideshow from Markdown or other formats

    Options:
      --version             show program's version number and exit
      -h, --help            show this help message and exit
      -c, --copy-theme      Copy theme directory into current presentation source
                            directory
      -b, --debug           Will display any exception trace to stdout
      -d FILE, --destination=FILE
                            The path to the to the destination file: .html or .pdf
                            extensions allowed (default: presentation.html)
      -e ENCODING, --encoding=ENCODING
                            The encoding of your files (defaults to utf8)
      -i, --embed           Embed stylesheet and javascript contents,
                            base64-encoded images in presentation to make a
                            standalone document
      -l LINENOS, --linenos=LINENOS
                            How to output linenos in source code. Three options
                            availables: no (no line numbers); inline (inside <pre>
                            tag); table (lines numbers in another cell, copy-paste
                            friendly)
      -o, --direct-output   Prints the generated HTML code to stdout; won't work
                            with PDF export
      -P, --no-presenter-notes
                            Don't include presenter notes in the output
      -q, --quiet           Won't write anything to stdout (silent mode)
      -r, --relative        Make your presentation asset links relative to current
                            pwd; This may be useful if you intend to publish your
                            html presentation online.
      -t THEME, --theme=THEME
                            A theme name, or path to a landlside theme directory
      -v, --verbose         Write informational messages to stdout (enabled by
                            default)
      -x EXTENSIONS, --extensions=EXTENSIONS
                            Comma-separated list of extensions for Markdown
      -w, --watch           Watch source directory for changes and regenerate
                            slides
      -m, --math-output     Enable mathematical output using MathJax

    Note: PDF export requires the `prince` program: http://princexml.com/

二. 使用配置文件

聲明配置文件如下: 必須聲明 [landslide] 配置項

$ cat config.cfg
  [landslide]
  theme = /path/to/mytheme
  source = myslice_source.md
           a_dir
           another_dir
           now_a_slide.markdown
           another_one.rst
  destination = /path/to/dest/presentation.html
  css =    my_first_stylesheet.css
           my_other_stylesheet.css
  js =     jquery.js
           my_fancy_javascript.js
  relative = True
  linenos = inline

--- 使用配置文件生成 slide
$ landslide config.cfg

三. Macros

宏的使用, 必須緊緊跟在標題之後, 否則不生效!!!

1. notes

使用 .notes: 關鍵字在 slide 中聲明 註釋說明.

# My Slide Title
.notes: These are my notes, hidden by default

My visible content goes here.

使用數字鍵 2 來打開顯示 筆記.

2. QR Codes

使用 .qr 關鍵字添加一個 二維碼到 slide 中.

---
# 關注我們
.qr: 450|https://www.pyfdtic.com

掃一掃, 關注我們!

3. Presenter Notes

在同一個頁面中, 以 h1 標題模式, 聲明另一個 # Presenter Notes, 可以作爲 演講者筆記 形式出現, 使用快捷鍵 p 顯示和隱藏 筆記.

---
# 北京
You can also add presenter notes to each slide by following the slide content with a heading entitled "Presenter Notes". Press the 'p' key to open the presenter view.

# Presenter Notes
這纔是我要說的, 你知道嗎.

四. markdown 寫作提要

  • Markdown 源文件, 必須以 .md/.markdn/.mdwn/.mdown/.markdown
  • --- : 三個以上的 橫線 表示強制分頁.
  • 每個 slide 頁面應該用一個 # 來表示 渲染 h1 標題
  • open NAME.html iterm2 會自動用瀏覽器打開該 html 頁面. open 命令會使用系統定義的 文件默認打開程序 打開文件.

# PPT # markdown

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章