Skip to content

rayrc/md2googleslides

 
 

Repository files navigation

md2googleslides -- Markdown to Google Slides

Generate Google Slides from markdown & HTML. Run from the command line or embed in another application.

This project was developed as an example of how to use the Slides API.

While it does not yet produce stunningly beautiful decks, you are encouraged to use this tool for quickly prototyping presentations.

Contributions are welcome.

Installation and usage

For command line use, install md2gslides globally:

$ npm install -g md2gslides

After installing, import your slides by running:

$ md2gslides slides.md

The first time the command is run you will be prompted for authorization. Credentials will be stored locally in a file named ~/.credentials/md2gslides.json.

Supported markdown rules

md2gslides uses a subset of the CommonMark and Github Flavored Markdown rules for markdown.

Slides

Each slide is typically represented by a header, followed by zero or more block elements.

Begin a new slide with a horizontal rule (---). The separator may be omitted for the first slide.

The following examples show how to create slides of various layouts:

Title slide

    ---

    # This is a title slide
    ## Your name here

Title slide

Section title slides

    ---

    # This is a section title

Section title slide

Section title & body slides

    ---

    # Section title & body slide

    ## This is a subtitle

    This is the body

Section title & body slide

Title & body slides

    ---

    # Title & body slide

    This is the slide body.

Title & body slide

Main point slide

Add {.big} to the title to make a slide with one big point

    ---

    # This is the main point {.big}

Main point slide

Big number slide

Use {.big} on a header in combination with a body too.

    ---

    # 100% {.big}

    This is the body

Big number slide

Two column slides

Separate columns with {.column}. The marker must appear on its own line with a blank both before and after.

    ---

    # Two column layout

    This is the left column

    {.column}

    This is the right column

Two column slide

Images

Inline images

Images can be placed on slides using image tags. Multiple images can be included. Mulitple images in a single paragraph are arranged in columns, mutiple paragraphs arranged as rows.

Note: Images are currently scaled and centered to fit the slide template.

    ---

    # Slides can have images

    ![](https://placekitten.com/900/900)

Slide with image

Background images

Set the background image of a slide by adding {.background} to the end of an image URL.

    ---

    # Slides can have background images

    ![](https://placekitten.com/1600/900){.background}

Slide with background image

Videos

Includes YouTube videos with a modified image tag.

    ---

    # Slides can have videos

    @[youtube](MG8KADiRbOU)

Slide with video

Formatting

Basic formatting rules are allowed, including:

  • Bold
  • Italics
  • Code
  • Hyperlinks
  • Ordered lists
  • Unordered lists

The following markdown illustrates a few common styles.

**Bold** and *italics* may be used.

Ordered lists:
1. Item 1
1. Item 2
  1. Item 2.1

Unordered lists:
* Item 1
* Item 2
  * Item 2.1

Emoji

Use Github style emoji in your text using the :emoji:.

The following example inserts emoji in the header and body of the slide.

### I :heart: cats

:heart_eyes_cat:

Code blocks

Both indented and fenced code blocks are supported, with syntax highlighting.

The following example renders highlighted code.

### Hello World

```javascript
console.log('Hello world');
```

To change the syntax highlight theme specify the --style <theme> option on the command line. All highlight.js themes are supported. For example, to use the github theme

$ md2gslides slides.md --style github

Tables

Tables are supported via GFM syntax.

Note: Including tables and other block elements on the same slide may produce poor results with overlapping elements. Either avoid or manually adjust the layout after generating the slides.

The following generates a 2x5 table on the slide.

### Top pets in the United States

Animal | Number
-------|--------
Fish   | 142 million
Cats   | 88 million
Dogs   | 75 million
Birds  | 16 million

Contributing

With the exception of /bin/md2gslides.js, ES6 is used throughout and compiled with Babel. Mocha and Chai are used for testing.

To compile:

$ npm run compile

To run unit tests:

$ npm run test

See CONTRIBUTING for additional terms.

License

This library is licensed under Apache 2.0. Full license text is available in LICENSE.

About

Generate Google Slides from markdown

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%