#Octal literal in strict mode with markdown images

9 messages · Page 1 of 1 (latest)

white gull
#

I'm having some issues understanding how images work in markdown because the docs say things should work but in many cases I get an error like this one:

Parse failure: Octal literal in strict mode (9:130)
At file: E:/Dev/snape.me/src/content/posts/2009/04/using-integration-services-to-populate-a-date-dimension.md
Contents of line 9: 'image_3.png': await getImageSafely((await import("image_3.png")).default, "image_3.png", "/E:\Dev\snape.me\src\content\posts\2009\04\image_3.png")

As far as I can work out its having an issue with the 2009/04 part of the URL where my content is posted.

I don't get this error when I use an image path outside of the content tree. So:

  • public/images/image_3.png works (public)
  • @assets/images/rjrwebdesign_3.png (src/assets) works when I convert the md to mdx and import

If I move the markdown to a different folder e.g. /posts/using-integration-services-to-populate-a-date-dimension.md then I can also get it to load an image in the same path as the markdown page.

This is a very basic blog that I'm working on. Code is here: https://github.com/jsnape/snape.me versions below.

"dependencies": {
"<@&1055234544183287879>/mdx": "^1.0.1",
"astro": "^3.0.7"
},
"devDependencies": {
"<@&1055234544183287879>/tailwind": "^5.0.0",
"@tailwindcss/typography": "^0.5.9",
"tailwindcss": "^3.3.3"
}

A simple question - is the octal issue with content in ...2009/06... paths a bug or just not allowed?

I would prefer to to be allowed so I can replicate my existing wordpress site.

GitHub

My personal site. Contribute to jsnape/snape.me development by creating an account on GitHub.

pallid tangleBOT
#
Quiet in here?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

white gull
#

I think I have an answer to my own question. I think the images for markdown content must start with either a ./ or a / depending if you have the image in the content folder (./) or the public folder /). Additionally, images in the /src/assets folder need to be imported first. The error message is super misleading though as in reality it just can't find the file referenced.

spark elm
#

I think what's happening is that the Windows path is escaping the numbers in your file names by accident

#

We should sanitize the path here because of that

#

If you have time, creating an issue for it would be amazing (no need for a repro, since it only happens on Windows)

#

!issue

wise vigilBOT
white gull