deck

package module
v0.13.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 23 Imported by: 0

README

deck

deck

deck is a tool for creating deck using Markdown and Google Slides.

Key concept

  • Continuous deck building
    • Generate and modify deck iteratively.
  • Separate content and design
    • Markdown for content, Google Slides for design.

Usage

Setup
Get and set your OAuth client credentials
  • Create (or reuse) a developer project at https://console.cloud.google.com.
  • Enable Google Slides API and Google Drive API at API & Services page.
  • Go to Credentials page and click + CREATE CREDENTIALS at the top.
  • Create OAuth client ID type of credentials.
  • Choose type Desktop app.
  • Download credentials file to ~/.local/share/deck/credentials.json ( or ${XDG_DATA_HOME}/deck/credentials.json ).
Get presentation ID
When using an existing presentation

Get the presentation ID you want to operate. You can get a list with deck ls.

For example, presentation ID is xxxxxXXXXxxxxxXXXXxxxxxxxxxx of https://docs.google.com/presentation/d/xxxxxXXXXxxxxxXXXXxxxxxxxxxx/edit .

When creating a new presentation

You can create a new presentation with the deck new command and obtain the presentation ID.

If you want to apply a theme, specify the presentation ID of a presentation that is already using that theme with the --from option.

$ deck new --from yyyyyyyYYYYyYYYYYYYyyyyyyyyy --title "Talk about deck"
xxxxxXXXXxxxxxXXXXxxxxxxxxxx
Write desk in markdown

The slide pages are represented by dividing them with horizontal lines ---.

[!NOTE] The --- at the beginning of the markdown is ignored.

Apply desk written in markdown to Google Slides presentation
$ deck apply xxxxxXXXXxxxxxXXXXxxxxxxxxxx deck.md

Support markdown rules

Insertion rule

deck inserts values according to the following rules regardless of the slide layout.

  • Heading1 (#) is inserted into the title placeholder ( CENTERED_TITLE ) in order.
  • Heading2 (##) is inserted into the subtitle placeholder ( SUBTITLE ) in order.
  • All other items are inserted into the body placeholder ( BODY ) in order.

[!NOTE] They are inserted in the order they appear in the markdown document, from the placeholder at the top of the slide (or from the placeholder on the left if the slides are the same height).

Input markdown document
# CAP theorem

## In Database theory

## Consistency

Every read receives the most recent write or an error.

## Availability

Every request received by a non-failing node in the system must result in a response.

## Partition tolerance

The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes.
Layout and placeholders

img

Result of applying

img

Support syntax in body
  • Bold ( **bold** )
  • Italic ( *italic* __italic__ )
  • List ( - * )
  • Ordered list ( 1. 1) )
  • Link ( [Link](https://example.com)
  • <br> (for newline)
Comment

The comments <!-- --> are used as a speaker notes or page config.

Page config

If the comment <!-- --> can be JSON-encoded, it will be processed as page config.

<!-- {"layout": "title-and-body"} -->
"layout":

It is possible to specify the page layout.

The layout name (e.g. title-and-body) is specified.

<!-- {"layout": "title-and-body"} -->

img

[!TIP] With deck ls-layouts it is possible to obtain a list of the layout names for a specific presentation.

$ deck ls-layouts xxxxxXXXXxxxxxXXXXxxxxxxxxxx
title
section
section-dark
title-and-body
title-and-body-half
title-and-body-2col
title-and-body-3col
"freeze":

It is possible to skip the operation of the target page.

[!TIP] If you set it to a page that has been completed with layout and design, the page will not be modified unnecessarily by deck.

<!-- {"freeze": true} -->

Install

homebrew tap:

$ brew install k1LoW/tap/deck

go install:

$ go install github.com/k1LoW/deck/cmd/deck@latest

manually:

Download binary from releases page

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deck

type Deck struct {
	// contains filtered or unexported fields
}

func Create added in v0.3.0

func Create(ctx context.Context) (*Deck, error)

Create Google Slides presentation.

func CreateFrom added in v0.3.0

func CreateFrom(ctx context.Context, id string) (*Deck, error)

CreateFrom creates a new Deck from the presentation ID.

func New

func New(ctx context.Context, opts ...Option) (*Deck, error)

New creates a new Deck.

func (*Deck) Apply

func (d *Deck) Apply(slides md.Slides) error

Apply the markdown slides to the presentation.

func (*Deck) ApplyPages added in v0.10.0

func (d *Deck) ApplyPages(slides md.Slides, pages []int) error

ApplyPages applies the markdown slides to the presentation with the specified pages.

func (*Deck) CreatePage

func (d *Deck) CreatePage(index int, page *md.Page) error

func (*Deck) DeletePage

func (d *Deck) DeletePage(index int) error

func (*Deck) DeletePageAfter

func (d *Deck) DeletePageAfter(index int) error

func (*Deck) Export

func (d *Deck) Export(w io.Writer) error

Export the presentation as PDF.

func (*Deck) ID added in v0.3.0

func (d *Deck) ID() string

ID returns the ID of the presentation.

func (*Deck) List

func (d *Deck) List() ([]*Slide, error)

List Google Slides presentations.

func (*Deck) ListLayouts

func (d *Deck) ListLayouts() []string

ListLayouts lists layouts of the presentation.

func (*Deck) UpdateTitle added in v0.3.0

func (d *Deck) UpdateTitle(title string) error

UpdateTitle updates the title of the presentation.

type Option added in v0.10.0

type Option func(*Deck) error

func WithLogger added in v0.10.0

func WithLogger(logger *slog.Logger) Option

func WithPresentationID added in v0.10.0

func WithPresentationID(id string) Option

type Slide

type Slide struct {
	ID    string
	Title string
}

func List added in v0.3.0

func List(ctx context.Context) ([]*Slide, error)

List Google Slides presentations.

Directories

Path Synopsis
cmd
handler
dot
Package md provides functionality for parsing markdown into slides.
Package md provides functionality for parsing markdown into slides.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL