Support multicell selection in markdown conversion

Fixes #803

(c) Copyright IBM Corp. 2015
This commit is contained in:
Peter Parente 2015-12-08 22:31:52 -05:00
parent eb2ad5fcf6
commit 258470e19c
3 changed files with 18 additions and 2 deletions

View File

@ -254,7 +254,7 @@ define(function(require){
help : 'to markdown',
help_index : 'cb',
handler : function (env) {
env.notebook.to_markdown();
env.notebook.cells_to_markdown();
}
},
'change-cell-to-raw' : {

View File

@ -111,7 +111,7 @@ define([
that.notebook.cells_to_code();
break;
case 'markdown':
that.notebook.to_markdown();
that.notebook.cells_to_markdown();
break;
case 'raw':
that.notebook.cells_to_raw();

View File

@ -1191,6 +1191,7 @@ define(function (require) {
this.to_code(indices[i]);
}
};
/**
* Turn a cell into a code cell.
*
@ -1222,6 +1223,21 @@ define(function (require) {
}
};
/**
* Turn one or more cells into Markdown.
*
* @param {Array} indices - cell indices to convert
*/
Notebook.prototype.cells_to_markdown = function (indices) {
if (indices === undefined) {
indices = this.get_selected_cells_indices();
}
for(var i=0; i < indices.length; i++) {
this.to_markdown(indices[i]);
}
};
/**
* Turn a cell into a Markdown cell.
*