slides

maaslalaniMIT更新放缓

在终端里用 Markdown 写幻灯片并直接演示,省去打开浏览器或 PPT 软件的步骤,适合开发者做技术分享。

Terminal based presentation tool

v0.9.0发布于 2022-09-13 14:32 UTC11,705star +4 / 7 天319fork同步于 2026-11-10 23:29 UTC

怎么上手

由 README 提炼,执行前请确认
brew install slides
slides presentation.md
硬件要求按 README 说明

README 未说明;纯终端工具,无 GPU 或显存要求

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

在终端里用 Markdown 写并放映幻灯片,不用离开命令行

在终端里用 Markdown 写幻灯片并直接演示,省去打开浏览器或 PPT 软件的步骤,适合开发者做技术分享。

核心能力

  • 用 Markdown 文件分页编写幻灯片
  • 按 ctrl+e 直接执行当前页代码块并显示输出
  • 用三波浪线代码块做预处理,把命令 stdout 替换进幻灯片
  • 支持 slides serve 通过 SSH 远程放映
  • 文件改动自动热更新,也支持从 stdin 读入

容易踩的坑

预处理功能要求传入的 .md 文件有可执行权限,需先 chmod +x;slides serve 默认监听 53531 端口,SSH 连接要指定该端口;代码执行与预处理会实际运行命令,注意来源可信

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.9.0
  1. v0.9.0最新正式版2022-09-13 · 2022-09-13 14:32 UTC

    Slides over SSH

    You will be able to access the presentation hosted over SSH! You can use this to present with slides from a computer that doesn't have slides installed, but does have ssh. Or, let your viewers have access to the slides on their own computer without needing to download slides and the presentation file. (Thanks to @ivantsepp!)

    slides serve <file>
    

    And then ssh into your presentation with:

    ssh 127.0.0.1 -p 53531
    

    What's Changed

    New Contributors

    Full Changelog: https://github.com/maaslalani/slides/compare/v0.8.0...v0.9.0

  2. v0.8.02022-04-07 · 2022-04-07 19:22 UTC
    查看更新说明

    What's Changed

  3. v0.7.32022-02-15 · 2022-02-15 18:09 UTC
    查看更新说明

    Changelog

    • Bump lots of dependencies
    • Get rid of lots of dependencies (Removed over 600 lines from go.sum)

    Full Changelog: https://github.com/maaslalani/slides/compare/v0.7.2...v0.7.3

  4. v0.7.22021-11-01 · 2021-11-01 18:32 UTC
    查看更新说明

    Changelog

    What's Changed

  5. v0.7.12021-11-01 · 2021-11-01 15:45 UTC
    查看更新说明

    Changelog

    Changes

    Bug Fixes

    • Fixed bug with executing the same code block multiple times.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Slides

    Slides in your terminal.

    Installation

    Homebrew Snapcraft AUR

    MacOS
    brew install slides
    
    Arch
    yay -S slides
    
    Nixpkgs (unstable)
    nix-env -iA nixpkgs.slides
    
    Any Linux Distro running snapd
    sudo snap install slides
    
    Go
    go install github.com/maaslalani/slides@latest
    

    From source:

    git clone https://github.com/maaslalani/slides.git
    cd slides
    go install
    

    You can also download a binary from the releases page.

    Usage

    Create a simple markdown file that contains your slides:

    # Welcome to Slides
    A terminal based presentation tool
    
    ---
    
    ## Everything is markdown
    In fact, this entire presentation is a markdown file.
    
    ---
    
    ## Everything happens in your terminal
    Create slides and present them without ever leaving your terminal.
    
    ---
    
    ## Code execution
    ```go
    package main
    
    import "fmt"
    
    func main() {
      fmt.Println("Execute code directly inside the slides")
    }
    ```
    
    You can execute code inside your slides by pressing `<C-e>`,
    the output of your command will be displayed at the end of the current slide.
    
    ---
    
    ## Pre-process slides
    
    You can add a code block with three tildes (`~`) and write a command to run *before* displaying
    the slides, the text inside the code block will be passed as `stdin` to the command
    and the code block will be replaced with the `stdout` of the command.
    
    ```
    ~~~graph-easy --as=boxart
    [ A ] - to -> [ B ]
    ~~~
    ```
    
    The above will be pre-processed to look like:
    
    ┌───┐  to   ┌───┐
    │ A │ ────> │ B │
    └───┘       └───┘
    
    For security reasons, you must pass a file that has execution permissions
    for the slides to be pre-processed. You can use `chmod` to add these permissions.
    
    ```bash
    chmod +x file.md
    ```
    
    

    Checkout the example slides.

    Then, to present, run:

    slides presentation.md
    

    If given a file name, slides will automatically look for changes in the file and update the presentation live.

    slides also accepts input through stdin:

    curl http://example.com/slides.md | slides
    

    Go to the first slide with the following key sequence:

    • g g

    Go to the next slide with any of the following key sequences:

    • space
    • right
    • down
    • enter
    • n
    • j
    • l
    • Page Down
    • number + any of the above (go forward n slides)

    Go to the previous slide with any of the following key sequences:

    • left
    • up
    • p
    • h
    • k
    • N
    • Page Up
    • number + any of the above (go back n slides)

    Go to a specific slide with the following key sequence:

    • number + G

    Go to the last slide with the following key:

    • G

    Search

    To quickly jump to the right slide, you can use the search function.

    Press /, enter your search term and press Enter
    (The search term is interpreted as a regular expression. The /i flag causes case-insensitivity.).

    Press ctrl+n after a search to go to the next search result.

    Code Execution

    If slides finds a code block on the current slides it can execute the code block and display the result as virtual text on the screen.

    Press ctrl+e on a slide with a code block to execute it and display the result.

    Pre-processing

    You can add a code block with three tildes (~) and write a command to run before displaying the slides, the text inside the code block will be passed as stdin to the command and the code block will be replaced with the stdout of the command. Wrap the pre-processed block in three backticks to keep proper formatting and new lines.

    ```
    ~~~graph-easy --as=boxart
    [ A ] - to -> [ B ]
    ~~~
    ```
    

    The above will be pre-processed to look like:

    ┌───┐  to   ┌───┐
    │ A │ ────> │ B │
    └───┘       └───┘
    

    For security reasons, you must pass a file that has execution permissions for the slides to be pre-processed. You can use chmod to add these permissions.

    chmod +x file.md
    

    Configuration

    slides allows you to customize your presentation's look and feel with metadata at the top of your slides.md.

    This section is entirely optional, slides will use sensible defaults if this section or any field in the section is omitted.

    ---
    theme: ./path/to/theme.json
    author: Gopher
    date: MMMM dd, YYYY
    paging: Slide %d / %d
    ---
    
    • theme: Path to json file containing a glamour theme, can also be a link to a remote json file which slides will fetch before presenting.
    • author: A string to display on the bottom-left corner of the presentation view. Defaults to the OS current user's full name. Can be empty to hide the author.
    • date: A string that is used to format today's date in the YYYY-MM-DD format. If the date is not a valid format, the string will be displayed. Defaults to YYYY-MM-DD.
    • paging: A string that contains 0 or more %d directives. The first %d will be replaced with the current slide number and the second %d will be replaced with the total slides count. Defaults to Slide %d / %d. You will need to surround the paging value with quotes if it starts with %.
    Date format

    Given the date January 02, 2006:

    ValueTranslates to
    YYYY2006
    YY06
    MMMMJanuary
    MMMJan
    MM01
    mm1
    DD02
    dd2

    SSH

    Slides is accessible over ssh if hosted on a machine through the slides serve [file] command.

    On a machine, run:

    slides serve [file]
    

    Then, on another machine (or same machine), ssh into the port specified by the slides serve [file] command:

    ssh 127.0.0.1 -p 53531
    

    You will be able to access the presentation hosted over SSH! You can use this to present with slides from a computer that doesn't have slides installed, but does have ssh. Or, let your viewers have access to the slides on their own computer without needing to download slides and the presentation file.

    Alternatives

    Credits: This project was heavily inspired by lookatme.

    Development

    See the development documentation