Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test backslash in markdown #363

Merged
merged 5 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jupytext/cell_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, cell, default_language, fmt=None):
self.ext = self.fmt.get('extension')
self.cell_type = cell.cell_type
self.source = cell_source(cell)
self.unfiltered_metadata = cell.metadata
self.unfiltered_metadata = copy(cell.metadata)
self.metadata = filter_metadata(copy(cell.metadata),
self.fmt.get('cell_metadata_filter'),
_IGNORE_CELL_METADATA)
Expand Down
73 changes: 73 additions & 0 deletions tests/notebooks/ipynb_py/Line_breaks_in_LateX_305.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This cell uses no particular cell marker\n",
"\n",
"$$\n",
"\\begin{align}\n",
"\\dot{x} & = \\sigma(y-x)\\\\\n",
"\\dot{y} & = \\rho x - y - xz \\\\\n",
"\\dot{z} & = -\\beta z + xy\n",
"\\end{align}\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This cell uses no particular cell marker, and a single slash in the $\\LaTeX$ equation\n",
"\n",
"$$\n",
"\\begin{align}\n",
"\\dot{x} & = \\sigma(y-x) \\\n",
"\\dot{y} & = \\rho x - y - xz \\\n",
"\\dot{z} & = -\\beta z + xy\n",
"\\end{align}\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_marker": "'''"
},
"source": [
"This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305\n",
"\n",
"$$\n",
"\\begin{align}\n",
"\\dot{x} & = \\sigma(y-x)\\\\\n",
"\\dot{y} & = \\rho x - y - xz \\\\\n",
"\\dot{z} & = -\\beta z + xy\n",
"\\end{align}\n",
"$$"
]
}
],
"metadata": {
"celltoolbar": "Edit Metadata",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
39 changes: 39 additions & 0 deletions tests/notebooks/mirror/ipynb_to_Rmd/Line_breaks_in_LateX_305.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
---

This cell uses no particular cell marker

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$


This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation

$$
\begin{align}
\dot{x} & = \sigma(y-x) \
\dot{y} & = \rho x - y - xz \
\dot{z} & = -\beta z + xy
\end{align}
$$


This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---

# %% [markdown]
# This cell uses no particular cell marker
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x)\\
# \dot{y} & = \rho x - y - xz \\
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# %% [markdown]
# This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x) \
# \dot{y} & = \rho x - y - xz \
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# %% [markdown]
'''
This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
'''
39 changes: 39 additions & 0 deletions tests/notebooks/mirror/ipynb_to_md/Line_breaks_in_LateX_305.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
---

This cell uses no particular cell marker

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$


This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation

$$
\begin{align}
\dot{x} & = \sigma(y-x) \
\dot{y} & = \rho x - y - xz \
\dot{z} & = -\beta z + xy
\end{align}
$$


This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---

# %% [markdown]
# This cell uses no particular cell marker
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x)\\
# \dot{y} & = \rho x - y - xz \\
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# %% [markdown]
# This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x) \
# \dot{y} & = \rho x - y - xz \
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# %% [markdown]
'''
This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
'''
40 changes: 40 additions & 0 deletions tests/notebooks/mirror/ipynb_to_script/Line_breaks_in_LateX_305.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---

# This cell uses no particular cell marker
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x)\\
# \dot{y} & = \rho x - y - xz \\
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x) \
# \dot{y} & = \rho x - y - xz \
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# + [markdown]
'''
This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
'''
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ---
# jupyter:
# jupytext:
# cell_markers: '{{{,}}}'
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---

# This cell uses no particular cell marker
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x)\\
# \dot{y} & = \rho x - y - xz \\
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x) \
# \dot{y} & = \rho x - y - xz \
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# {{{ [markdown]
'''
This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
'''
# }}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ---
# jupyter:
# jupytext:
# cell_markers: region,endregion
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---

# This cell uses no particular cell marker
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x)\\
# \dot{y} & = \rho x - y - xz \\
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# This cell uses no particular cell marker, and a single slash in the $\LaTeX$ equation
#
# $$
# \begin{align}
# \dot{x} & = \sigma(y-x) \
# \dot{y} & = \rho x - y - xz \
# \dot{z} & = -\beta z + xy
# \end{align}
# $$

# region [markdown]
'''
This cell uses the triple quote cell markers introduced at https://github.com/mwouts/jupytext/issues/305

$$
\begin{align}
\dot{x} & = \sigma(y-x)\\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
$$
'''
# endregion
Loading