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

Basic Excalidraw embed image Proof of Concept #1389

Draft
wants to merge 6 commits into
base: v4
Choose a base branch
from

Conversation

saberzero1
Copy link
Collaborator

@saberzero1 saberzero1 commented Sep 2, 2024

Closes #1043

  • Embed excalidraw png/svg
  • Filter *.excalidraw.md
  • change image with light/dark mode
  • Update documentation
    • Include light/dark mode instructions for excalidraw plugin

image

image

image

@jacobeverist
Copy link

Very cool, and very little code changes.

Don't know if this helps, but i found this gist as an example of dark/light mode switching. I'm not familiar with this codebase, so I may be wrong.

@saberzero1
Copy link
Collaborator Author

saberzero1 commented Sep 23, 2024

Very cool, and very little code changes.

Don't know if this helps, but i found this gist as an example of dark/light mode switching. I'm not familiar with this codebase, so I may be wrong.

Thanks for the heads-up! I have updated the code for generic image as well, see below for a preview (mild epilepsy warning)

Screencast.from.2024-09-23.20-11-38.webm

@bartkl
Copy link

bartkl commented Sep 28, 2024

Hi, I'm the author of the gist referenced by @jacobeverist, and I just wanted to point out that I have since improved that code and made it part of my Quartz website's repo. It has become the RenderExcalidraw component. You can check out the code here. The imported inline script is where all the magic happens, and loading this component is done in the my config files.

You can see the component in action here for example.

Anyways, it works pretty well, but I still wasn't sufficiently happy with it which is why I never contributed it to the Quartz project:

  • The JS file looks for blockquote tags with data-url pointing to a file ending with .excalidraw . This works well, but feels shaky. I would prefer handling this with Markdown transformers instead of in the component.
  • It is tied to Excalidraw images, whereas later on I realized I could generalize this any image really. However, handling images would be different from handling .excalidraw blockquote elements. This may be easy though if you'd take care of this in a transformer rather than in the JS.

I have documentend the code reasonably well I think, but proper user documentation still needs doing.

Anyways, looking forward to see how you finish this up :). Nice work!

@saberzero1
Copy link
Collaborator Author

Hi, I'm the author of the gist referenced by @jacobeverist, and I just wanted to point out that I have since improved that code and made it part of my Quartz website's repo. It has become the RenderExcalidraw component. You can check out the code here. The imported inline script is where all the magic happens, and loading this component is done in the my config files.

You can see the component in action here for example.

Anyways, it works pretty well, but I still wasn't sufficiently happy with it which is why I never contributed it to the Quartz project:

  • The JS file looks for blockquote tags with data-url pointing to a file ending with .excalidraw . This works well, but feels shaky. I would prefer handling this with Markdown transformers instead of in the component.
  • It is tied to Excalidraw images, whereas later on I realized I could generalize this any image really. However, handling images would be different from handling .excalidraw blockquote elements. This may be easy though if you'd take care of this in a transformer rather than in the JS.

I have documentend the code reasonably well I think, but proper user documentation still needs doing.

Anyways, looking forward to see how you finish this up :). Nice work!

Thanks for the input!

I'm currently looking into reworking the markdown parser steps. I have some thoughts on how to incorporate your code, but the specifics might change a bit after said rework. Luckily, your implementation seems relatively simple to adapt. I'll keep you posted.

@catacgc
Copy link

catacgc commented Nov 10, 2024

Looking forward to this. One feature that will be really cool is the ability to support Obsidian Excalidraw plugin embeds (other notes in the vault).

This will virtually transform quartz into an all-in-one documentation platform with mind mapping support

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

Successfully merging this pull request may close these issues.

Excalidraw support
4 participants