Skip to content

Instantly share code, notes, and snippets.

@dannysmith
Last active March 1, 2016 02:00
Show Gist options
  • Select an option

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

Select an option

Save dannysmith/d5507c4b4515d34eff0c to your computer and use it in GitHub Desktop.
Stip tables and background colours from Sublime Text HTMLExport
// Source: https://github.com/facelessuser/ExportHtml/issues/26
// 1. Export to HTML using "Export to HTML: Show Export Menu" and "Railscast Theme"
// 2. Run this in the Console
// 3. Copy from the browser and paste into powerpoint using Paste Special > Formatted Text.
// Tow work with Keynote, also need to turn off (uncheck) the CSS background colour on the body element.
var codeCells = document.querySelectorAll('table.code_page td.code_line');
console.log('Code Zeilen:', codeCells.length);
var table = document.createElement('table');
table.className = 'code_page';
document.querySelector('pre.code_page').appendChild(table);
var row = document.createElement('tr');
table.appendChild(row);
var cell = document.createElement('td');
cell.className = 'code_line';
row.appendChild(cell);
for (var i = 0; i < codeCells.length; i++) {
cell.appendChild(codeCells[i].firstChild);
}
# Stip background colours from spans.
var allSpans = document.querySelectorAll('span');
for (var i = 0; i < allSpans.length; i++) {
allSpans[i].style.background = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment