Skip to content

Commit

Permalink
Added support for .markdown extension
Browse files Browse the repository at this point in the history
Fixes #288
  • Loading branch information
mwouts committed Jul 17, 2019
1 parent 822a1d3 commit 52803a5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jupytext/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ def __init__(self,
current_version_number='1.1',
min_readable_version_number='1.0'),

NotebookFormatDescription(
format_name='markdown',
extension='.markdown',
header_prefix='',
cell_reader_class=MarkdownCellReader,
cell_exporter_class=MarkdownCellExporter,
current_version_number='1.1',
min_readable_version_number='1.0'),

NotebookFormatDescription(
format_name='rmarkdown',
extension='.Rmd',
Expand Down
18 changes: 18 additions & 0 deletions tests/test_contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,24 @@ def test_notebook_extensions(tmpdir):
assert model['type'] == 'file'


def test_markdown_and_r_extensions(tmpdir):
tmp_r = str(tmpdir.join('script.r'))
tmp_markdown = str(tmpdir.join('notebook.markdown'))

nb = new_notebook()
write(nb, tmp_r)
write(nb, tmp_markdown)

cm = jupytext.TextFileContentsManager()
cm.root_dir = str(tmpdir)

model = cm.get('script.r')
assert model['type'] == 'notebook'

model = cm.get('notebook.markdown')
assert model['type'] == 'notebook'


def test_server_extension_issubclass():
class SubClassTextFileContentsManager(jupytext.TextFileContentsManager):
pass
Expand Down

0 comments on commit 52803a5

Please sign in to comment.