ozntel / oz-image-in-editor-obsidian

This Obsidian plugin to view Images, Transclusions, iFrames and PDF Files within the Editor without a necessity to switch to Preview.
339 stars 13 forks source link

Header Reference Embed transclusion dev console errors for Untitled XX pages #62

Closed GitMurf closed 3 years ago

GitMurf commented 3 years ago

This is super weird but for whatever reasons Untitled pages are having issues with Header !embeds. I have recorded a video showing the couple issues.

Issue 1: On an untitled xx page, simply try to link to a header on that same page with ![[#]] and as soon as you type the hashtag you will see an error like this:

image

Issue 2: When trying to link to a Header on an Untitled XX page:

image

Here is a video showing both issues:

https://user-images.githubusercontent.com/64155612/131751779-40f6b795-ff46-4bf4-b2f9-d45618ee5c7b.mp4

ozntel commented 3 years ago

First issue should be resolved with the new release. It was because you were searching with empty file but provided header and it couldn't find cache for empty string ![[#HEADER]].

The second issue is not related with the line detecting, rather with the internal link that you have within the transclusion. I created some cleaning functions, which converts md links to more usable links for Obsidian but obviously it is not working always. Same goes with images. They were converted to html by md converter, however, Obsidian can not find them unless I convert them manually. You can see this function as reference how it cleans the links before sending for html render in Editor:

https://github.com/ozntel/oz-image-in-editor-obsidian/blob/b66e68473586e753ab276653310c06142dc55f24/src/utils.ts#L372

Just send me what you see as an HTML element here (with href)

Screenshot 2021-09-02 at 08 28 22

Maybe there can be a solution.

ozntel commented 3 years ago

Issue should be resolved in the new release