mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Support multicell selection in markdown conversion
Fixes #803 (c) Copyright IBM Corp. 2015
This commit is contained in:
parent
eb2ad5fcf6
commit
258470e19c
@ -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' : {
|
||||
|
@ -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();
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user