Skip to content

Commit

Permalink
use strip to determine cell magic
Browse files Browse the repository at this point in the history
  • Loading branch information
fecet committed Jul 2, 2023
1 parent 3cc5a85 commit 2bdfe42
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/jupynium/cells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function M.line_type(line)
return "cell separator: markdown (string)"
elseif utils.string_begins_with(line, "# %% [md]") or utils.string_begins_with(line, "# %% [markdown]") then
return "cell separator: markdown (jupytext)"
elseif utils.string_ends_with(line, "# %%") then
elseif vim.fn.trim(line)=="# %%" then
return "cell separator: code"
elseif utils.string_begins_with(line, '%%"""') or utils.string_begins_with(line, "%%'''") then
return "cell separator: code (string)"
Expand Down
2 changes: 1 addition & 1 deletion src/jupynium/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def full_analyse_buf(self, header_cell_type="header"):
num_rows_this_cell = 1
cell_types.append("markdown (jupytext)")
elif (
line[:5] == "# %%"
line.strip() == "# %%"
or line.startswith('%%"""')
or line.startswith("%%'''")
):
Expand Down

0 comments on commit 2bdfe42

Please sign in to comment.