diff --git a/mdit_py_plugins/myst_blocks/index.py b/mdit_py_plugins/myst_blocks/index.py index d0e4cf6..8a7c55a 100644 --- a/mdit_py_plugins/myst_blocks/index.py +++ b/mdit_py_plugins/myst_blocks/index.py @@ -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: @@ -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 diff --git a/tests/fixtures/myst_block.md b/tests/fixtures/myst_block.md index 90bf9d3..e39472b 100644 --- a/tests/fixtures/myst_block.md +++ b/tests/fixtures/myst_block.md @@ -69,6 +69,13 @@ Escaped target:

(a)=

. +Escaped target 2: +. +(a\)= +. +

(a)=

+. + Indented target: . (a)=