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

Scale image using alt text syntax #43

Open
regalialong opened this issue Jun 21, 2024 · 0 comments
Open

Scale image using alt text syntax #43

regalialong opened this issue Jun 21, 2024 · 0 comments

Comments

@regalialong
Copy link
Contributor

regalialong commented Jun 21, 2024

Obsidian has its own syntax for scaling images by defining the resolution in the alt text of an image (ignoring how yucky that is), the syntax is described here in the docs but for brevity:

  • ![[image.extension|666]] scale "according to its original aspect ratio"
    • Obsidian sets width on image element to 666 for this
    • This is technically not preferred for web content because this will cause a layout shift as width and height need to be defined for the browser to preallocate the space before the image loads in, but ¯\_(ツ)_/¯
  • ![[image.extension|666x666]] to set exact resolution
  • ![[image.extension|alt-text|666]] allows adding alt text while also setting the width of the image
    • o2w doesn't fail but (correctly) only adds the alt text currently when doing this
  • Also valid for external locations per ![666](https://externalfilelocation.example/image.extension)

We don't always control the size of images, especially externally linked ones, so having a way to scale them would be useful.

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