Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are not embedded if special characters are used within the image description #601

Closed
Noxellar opened this issue Jul 20, 2024 · 0 comments

Comments

@Noxellar
Copy link

As far as I am aware, only the backtick "`" (denoting inline code) and the single "$" and double "$$" dollar signs (denoting latex expressions) create this bug. When these characters are used in the alt text/image description for link embeds, the corresponding output in Anki is just the literal text of the embed instead of the image itself. From a bit of digging, I found out that it is the result of trying to match the already parsed note text to the original, unedited image embed text. I'll admit that this is a pretty strange edge-case but I'd appreciate it if this could be fixed.

The comparison is found in the format.ts file under FormatConverter.getAndFormatMedias()

Here, you get the failed comparison between "![[NOT Gate.svg|The ANSI notation for a OBSTOANKICODEINLINE gate]]" and "![[NOT Gate.svg|The ANSI notation for a NOT gate]]":

Debug console showing the exact spot in the loop where it fails (for my edge case)

Resulting in this unexpected output:

Should be an image of a NOT gate

It should be easy enough just to parse the embed.original text as well so that both are consistent with the expected value but I'm not sure if that's the best solution, seems kind of janky and a temporary patch. I would contribute any further changes myself but I'm not familiar enough with Typescript or the inner workings of the project to not break something horribly. Would it be better if a proper fix could be made further up the call stack before note_text is parsed?

Besides that, AWESOME project! I really appreciate the work you guys put in to make this entire system work. It's been invaluable to my studies. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant