extensions: Markdown Images Don't Render Correctly

Raycast version: 1.45.1

Description

I’ve made an extension that can render equations from latex or asciimath and it is ALMOST working 😂 I can actually render the equation as an “icon” (which you can see on the left) but when I place the image into the markdown, the image doesn’t show up at all:

Screenshot 2022-12-17 at 5 25 00 pm

The produced markdown by my code is:

  # This is the image
  <img src="http://localhost:38245/typeset?string=&&asciimath=true&inline=true" />
  <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png" />

The extension itself runs a local express server to serve the svgs (which is necessary to show the markdown). When I try this produced code with any markdown renderer (like stack edit), the image of the equation shows up correctly:

image

I’ve put this repo up onto github if you’d like to see the problem yourself. But it looks like I’m a little blocked here. I get no feedback as to why this image is not rendering.

Steps To Reproduce

  1. Clone the github repo I’ve shared
  2. Run npm run dev
  3. Run the extension and just type any equation (like e^x)
  4. You should see the icon as shown above, but the image in the markdown won’t render - I’m unsure about why

The current behavior

The rendered image (svg) doesn’t show up on the page

The expected behavior

The image should show up on the page

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Thanks so much for your help 😃

Okay, so it (looks like this approach works)[https://github.com/saivan/raycast-math-typeset/commit/25018adf3c39cb250b6e3102070abfff097b541a]. Thanks so much for your help:

image

It’s going to be a little trickier exporting this as a png and there are some other issues to debug. But this is great progress.

OH IT IS!!! If you zoom right in, you can actually see the svg - it’s just VERY TINY. Now the question would be, how do we make it bigger 🤔 This might be a dumb question (sorry I’m spamming this thread)