Skip to content

Instantly share code, notes, and snippets.

@dannysmith
Last active February 26, 2024 04:16
Show Gist options
  • Select an option

  • Save dannysmith/e3fa8a1cabd2984c4c79 to your computer and use it in GitHub Desktop.

Select an option

Save dannysmith/e3fa8a1cabd2984c4c79 to your computer and use it in GitHub Desktop.

Intro

When building Keynote or PowerPoint presentations, I've often wanted an easy way to copy and paste from Sublime Text 3 into the slides, maintaining just the font and sytax highlighting. Thanks to the ExportHTML ST3 plugin and a bookmarklet, I now have it.

If you just want the bookmarklet, here it is...

Browser Support

Keynote PowerPoint
Safari
Chrome
Firefox

Installation & Setup

  1. Install Isaac Muses ExportHTML plugin for Sublime Text.
  2. [Visit this page] and drag the bookmarklet to your bookmarks bar.
  3. Setting up your theme
  4. Set up your ExportHTML settings.

Setting up a tmTheme file

TODO

Your ExportHTML Settings

Open your ExportHTML User Settings file (Sublime Text > Preferences > Package Settings). There are a variety of configuration options available, but dince we're using ExportHTML just to copy/paste into keynote, we want the simplest settings possible.

Turn off numbers, browser print, gutters and header.

{
  "html_panel": [
    {
      "Sparta Theme without Backgrounds": {
        "numbers": false,
        "browser_print": false,
        "color_scheme": "Packages/User/spartaglobal.tmTheme",
        "style_gutter": false,
        "no_header": true
      }
    }
  ]
}

You could also set up a key binding:

  {
    "keys": ["ctrl+alt+super+n"],
    "command": "export_html",
    "args": {
          "numbers": false,
          "browser_print": false,
          "color_scheme": "Packages/User/spartaglobal.tmTheme",
          "style_gutter": false,
          "no_header": true
    }
  }

Usage

  1. Open the Sublime Text Command Palette and use the fuzzy search to find "Export to HTML: Show Export Menu".

![http://f.cl.ly/items/1N3C303c3A2D2N0Z2B1g/st_palette_exporthtml.png]

  1. Hit enter. You should see the export theme's you set up in the ExportHTML settings. Choose the right one and hit enter again.
  2. This should open Safari showing your code.
  3. Click the bookmarklet.
  4. Select and copy the code from your browser (⌘ + A then ⌘ + C).
  5. Paste into Keynote (⌘ + V) or "Paste Special" into PowerPoint for mac (^ + ⌘ + V then ⏎).

Thanks

Obviously, thanks to Isaac Muse (@facelessuser) for making the ExportHTML plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment