Skip to content

Commit

Permalink
Update MyST default to .md in nbextension
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 17, 2020
1 parent ee2ae39 commit 6d2084e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jupytext/nbextension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ define([
}

var notebook_extension = Jupyter.notebook.notebook_path.split('.').pop();
notebook_extension = ['ipynb', 'md', 'Rmd', 'mnb'].indexOf(notebook_extension) == -1 ? 'auto' : notebook_extension;
notebook_extension = ['ipynb', 'md', 'Rmd'].indexOf(notebook_extension) == -1 ? 'auto' : notebook_extension;
for (var i in formats) {
var ext = formats[i].split(':')[0];
if (ext==notebook_extension)
return formats;
}

// the notebook extension was not found among the formats
if (['ipynb', 'md', 'Rmd', 'mnb'].indexOf(notebook_extension)!=-1)
if (['ipynb', 'md', 'Rmd'].indexOf(notebook_extension)!=-1)
formats.push(notebook_extension);
else {
var format_name = Jupyter.notebook.metadata.jupytext && Jupyter.notebook.metadata.jupytext.text_representation
Expand All @@ -66,7 +66,7 @@ define([
$('#jupytext_pair_' + fmt.replace(':', '_') + ' > .fa').toggleClass('fa-check', true);

// any custom format?
if (['ipynb', 'auto:light', 'auto:percent', 'auto:hydrogen', 'auto:nomarker', 'md', 'Rmd', 'mnb'].indexOf(fmt)==-1)
if (['ipynb', 'auto:light', 'auto:percent', 'auto:hydrogen', 'auto:nomarker', 'md', 'Rmd', 'md:myst'].indexOf(fmt)==-1)
$('#jupytext_pair_custom' + ' > .fa').toggleClass('fa-check', true);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ define([
}
var formats = getSelectedJupytextFormats();
var notebook_extension = Jupyter.notebook.notebook_path.split('.').pop();
notebook_extension = ['ipynb', 'md', 'Rmd', 'mnb'].indexOf(notebook_extension) == -1 ? 'auto' : notebook_extension;
notebook_extension = ['ipynb', 'md', 'Rmd'].indexOf(notebook_extension) == -1 ? 'auto' : notebook_extension;

// Toggle the selected format
var index = formats.indexOf(format);
Expand Down Expand Up @@ -295,9 +295,9 @@ define([
JupytextActions.append(jupytext_pair('auto:percent', 'Pair Notebook with percent Script'));
JupytextActions.append(jupytext_pair('auto:hydrogen', 'Pair Notebook with Hydrogen Script'));
JupytextActions.append(jupytext_pair('auto:nomarker', 'Pair Notebook with nomarker Script'));
JupytextActions.append(jupytext_pair('md', 'Pair Notebook with Markdown', notebook_extension!=='md'));
JupytextActions.append(jupytext_pair('md', 'Pair Notebook with Markdown'));
JupytextActions.append(jupytext_pair('md:myst', 'Pair Notebook with MyST Markdown'));
JupytextActions.append(jupytext_pair('Rmd', 'Pair Notebook with R Markdown', notebook_extension!=='Rmd'));
JupytextActions.append(jupytext_pair('mnb', 'Pair Notebook with MyST-NB', notebook_extension!=='mnb'));
JupytextActions.append(jupytext_pair('custom', 'Custom pairing'));
JupytextActions.append($('<li/>').addClass('divider'));
JupytextActions.append(toggle_metadata);
Expand Down

0 comments on commit 6d2084e

Please sign in to comment.