fix processing of link/image elements when they could be inside tables
This commit is contained in:
parent
1db86f968e
commit
821ae2d8a5
|
@ -152,6 +152,7 @@ class ObsidianImages(Extension):
|
||||||
int: The image width in pixels, or -1 if not specified.
|
int: The image width in pixels, or -1 if not specified.
|
||||||
int: The image height 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)
|
m = self.DIMS.match(s)
|
||||||
if m:
|
if m:
|
||||||
width = int(m.group(2))
|
width = int(m.group(2))
|
||||||
|
@ -248,11 +249,12 @@ class ObsidianLinks(Extension):
|
||||||
return 'invalid-reference'
|
return 'invalid-reference'
|
||||||
|
|
||||||
def _parse_reference(self, contents: str) -> tuple[str | None, str]:
|
def _parse_reference(self, contents: str) -> tuple[str | None, str]:
|
||||||
|
contents = contents.replace(r'\|','|') # handle case where we're inside tables
|
||||||
text = None
|
text = None
|
||||||
t = contents.split('|')
|
t = contents.split('|')
|
||||||
if len(t) > 1:
|
if len(t) > 1:
|
||||||
text = t[1]
|
text = t[1]
|
||||||
contents = t[0]
|
contents = t[0].rstrip('\\')
|
||||||
|
|
||||||
assert self._context.src_index is not None
|
assert self._context.src_index is not None
|
||||||
node, _ = self._context.src_index.lookup(contents)
|
node, _ = self._context.src_index.lookup(contents)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user