twostraws / IgniteSamples

Sample code for the Ignite static site generator.
Other
66 stars 15 forks source link

images in Markdown content fail to render .. #15

Closed gavineadie closed 4 months ago

gavineadie commented 4 months ago

In the MD article "swift-against-humanity.md" there are references to images of the form:

![Black card: The secret to . . . unwrapped optionals.](/images/sah1.jpg)

but the rendered page fails to display them. The image link is https://ignitesamples.hackingwithswift.com/images/sah1.jpg (404).

I wanted to include images in my *.md files but couldn't find a way. I wasn't sure if I had missed the mechanism or bumped into an Ignite oversight, so I read over IgniteSample. Since it suffers also, I'm absolving myself! I know this a busy week (for you, @twostraws, and me, same reason), so I'm not going to devise a fix soon. Just wanted it on record for alter attention.

twostraws commented 4 months ago

Is that just me forgetting to include the images in the repository? Might be easily rectified 🙂

gavineadie commented 4 months ago

.. while "forgetting to include the images in the repository" could well be true, and changing that would make the site render, I'm thinking that Ignite shouldn't allow be relying on our memories to top up the Build directory (or the server directory it's copied to)!

Unlike a StaticPage, a *.md page is too self-contained to know about the Build directory so any ![](file) can't be copied to it. Once the *.md has been processed into a long piece of HTML in a file, a higher level of Ignite puts that in Build but, by then, it's too late for any images.

The Markdown files are a big convenience and Ignite converts them to HTML nicely but I feel that convenience is limited because they stand alone and don't know anything about the rest of the site being generated. Can you make a link to a StaticPage from a Markdown file, for example?

My brain is overflowing from day 1 of WWDC and I promised myself I'd leave Ignite till next week .. LOL !

gavineadie commented 4 months ago

I'm going to close this issue because it's more complicated than I first thought and, when I feel on more solid ground, I'll open an issue next week at the Ignite repo for others to see, consider and opine.