@@ -33,6 +33,7 @@ const NOTEBOOK_UNDO = 'notebook.undo';
3333const NOTEBOOK_CURSOR_UP = 'notebook.cursorUp' ;
3434const NOTEBOOK_CURSOR_DOWN = 'notebook.cursorDown' ;
3535const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID = 'notebook.clearAllCellsOutputs' ;
36+ const RENDER_ALL_MARKDOWN_CELLS = 'notebook.renderAllMarkdownCells' ;
3637
3738// Cell Commands
3839const INSERT_CODE_CELL_ABOVE_COMMAND_ID = 'notebook.cell.insertCodeCellAbove' ;
@@ -261,6 +262,22 @@ registerAction2(class extends NotebookAction {
261262 }
262263} ) ;
263264
265+ registerAction2 ( class extends NotebookAction {
266+ constructor ( ) {
267+ super ( {
268+ id : RENDER_ALL_MARKDOWN_CELLS ,
269+ title : localize ( 'notebookActions.renderMarkdown' , "Render All Markdown Cells" ) ,
270+ category : NOTEBOOK_ACTIONS_CATEGORY ,
271+ precondition : NOTEBOOK_IS_ACTIVE_EDITOR ,
272+ f1 : true
273+ } ) ;
274+ }
275+
276+ async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
277+ renderAllMarkdownCells ( context ) ;
278+ }
279+ } ) ;
280+
264281registerAction2 ( class extends NotebookAction {
265282 constructor ( ) {
266283 super ( {
@@ -273,10 +290,19 @@ registerAction2(class extends NotebookAction {
273290 }
274291
275292 async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
293+ renderAllMarkdownCells ( context ) ;
276294 return context . notebookEditor . executeNotebook ( ) ;
277295 }
278296} ) ;
279297
298+ function renderAllMarkdownCells ( context : INotebookCellActionContext ) : void {
299+ context . notebookEditor . viewModel ! . viewCells . forEach ( cell => {
300+ if ( cell . cellKind === CellKind . Markdown ) {
301+ cell . editState = CellEditState . Preview ;
302+ }
303+ } ) ;
304+ }
305+
280306registerAction2 ( class extends NotebookAction {
281307 constructor ( ) {
282308 super ( {
0 commit comments