From 821ae2d8a5fd9d788fcd40e160e1623f99a62188 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Wed, 7 Aug 2024 00:15:01 -0600 Subject: [PATCH] fix processing of link/image elements when they could be inside tables --- src/dragonglass/mparse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dragonglass/mparse.py b/src/dragonglass/mparse.py index 546e9a1..63da1d7 100644 --- a/src/dragonglass/mparse.py +++ b/src/dragonglass/mparse.py @@ -152,6 +152,7 @@ class ObsidianImages(Extension): int: The image width in pixels, or -1 if not specified. int: The image height in pixels, or -1 if not specified. """ + s = s.replace(r'\|', '|') # handle case where we're inside tables m = self.DIMS.match(s) if m: width = int(m.group(2)) @@ -248,11 +249,12 @@ class ObsidianLinks(Extension): return 'invalid-reference' def _parse_reference(self, contents: str) -> tuple[str | None, str]: + contents = contents.replace(r'\|','|') # handle case where we're inside tables text = None t = contents.split('|') if len(t) > 1: text = t[1] - contents = t[0] + contents = t[0].rstrip('\\') assert self._context.src_index is not None node, _ = self._context.src_index.lookup(contents)