Skip to content
Open
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
5 changes: 3 additions & 2 deletions mdit_py_plugins/myst_blocks/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def target(state: StateBlock, startLine: int, endLine: int, silent: bool):
return False
if not text.endswith(")="):
return False
if not text[1:-2]:
content = text[1:-2]
if not content or "\\" in content:
return False

if silent:
Expand All @@ -134,7 +135,7 @@ def target(state: StateBlock, startLine: int, endLine: int, silent: bool):

token = state.push("myst_target", "", 0)
token.attrSet("class", "myst-target")
token.content = text[1:-2]
token.content = content
token.map = [startLine, state.line]

return True
Expand Down
7 changes: 7 additions & 0 deletions tests/fixtures/myst_block.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ Escaped target:
<p>(a)=</p>
.

Escaped target 2:
.
(a\)=
.
<p>(a)=</p>
.

Indented target:
.
(a)=
Expand Down