Summary:
HTML Report export of Notebook
Motivation:
Sharing my Code and Markdown Comments with my Team
Alternatives:
Export to Jupyter Notebook, Import Jupyter Notebook, Export Jupyter Notebook as HTML.
Question:
Is there already a possibilty? I tried HTML export, but the Output of my Code is missing (and the format doesnt look nice, but that would be ok)
@pascalbrunner there is currently only exporting to a .ipynb file, and this does not yet contain outputs (see #1503) also there is no export to any other format beside .ipynb however i briefly experimented in #1080 with pdf export.
I implemented a html export possibility for myself. Perhaps it also helps somebody or somebody can write a module out of it.
This way it exports the .ipynb and a .html with rendered output in Jupyters Notebook form.
I opened atom in developer mode and changed the export notebook to the following:
``
export default function exportNotebook() {
// TODO: Refactor to use promises, this is a bit "nested".
const saveNotebook = function(filename) {
if (!filename) {
return;
}
const ext = path.extname(filename) === "" ? ".ipynb" : "";
const fname =${filename}${ext};
writeFile(fname, stringifyNotebook(store.notebook), function(err, data) {
if (err) {
atom.notifications.addError("Error saving file", {
detail: err.message
});
} else {
atom.notifications.addSuccess("Save successful", {
detail:Saved notebook as ${fname}
});
}
const execSync = require('child_process').execSync;
const output = execSync(jupyter nbconvert --execute --to html ${fname}`, { encoding: 'utf-8' });
console.log('Output was:n', output);
});
};
dialog.showSaveDialog(saveNotebook);
}
Most helpful comment
I implemented a html export possibility for myself. Perhaps it also helps somebody or somebody can write a module out of it.
This way it exports the .ipynb and a .html with rendered output in Jupyters Notebook form.
I opened atom in developer mode and changed the export notebook to the following:
``
export default function exportNotebook() { // TODO: Refactor to use promises, this is a bit "nested". const saveNotebook = function(filename) { if (!filename) { return; } const ext = path.extname(filename) === "" ? ".ipynb" : ""; const fname =${filename}${ext}; writeFile(fname, stringifyNotebook(store.notebook), function(err, data) { if (err) { atom.notifications.addError("Error saving file", { detail: err.message }); } else { atom.notifications.addSuccess("Save successful", { detail:Saved notebook as ${fname}}); } const execSync = require('child_process').execSync; const output = execSync(jupyter nbconvert --execute --to html ${fname}`, { encoding: 'utf-8' });console.log('Output was:n', output);
});
};
dialog.showSaveDialog(saveNotebook);
}