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

[Markdown] Integrate Image-Support #578

Open
Bizarrus opened this issue Nov 21, 2024 · 8 comments
Open

[Markdown] Integrate Image-Support #578

Bizarrus opened this issue Nov 21, 2024 · 8 comments

Comments

@Bizarrus
Copy link

Images will be not shown.

Original:
grafik

Package-Site:
grafik

Example:

https://code.dlang.org/packages/coldbite?tab=info

@s-ludwig
Copy link
Member

I'm not sure why GitHub accepts the syntax, but instead of [![DOCUMENTATION]](https://github.com/coldbite/Engine/wiki), ![DOCUMENTATION](https://github.com/coldbite/Engine/wiki) should work and is what is expected by the parser. See the CommonMark spec for reference.

@Bizarrus
Copy link
Author

Bizarrus commented Nov 24, 2024

Because, it is nested. See the difference between leaf and container blocks.

![alt](src) = <img alt="$alt" src="$src">

[text](href) = <a href="$href">$href</a>

text will be replaced with the image:
[![src]](href) = <a href="$href"><img src="$src"></a>

See the CommonMark spec for reference.

Please study the reference, when you link it:

Note

The link text may contain inline content:
IMG-20241124-WA0001

@s-ludwig
Copy link
Member

Please study the reference, when you link it:

Sorry, I fail to see how the image you provided applies to the code you've written. Can you enlighten me?

@Bizarrus
Copy link
Author

Bizarrus commented Nov 25, 2024

You can reference Images an Links like:

[refImage]: http://example.cpm/image.png

Then you can use the references:

[![refImage]](http://example.com)

Thats the same like:

[![alt](http://example.com/image.png)](http://example.com)

A live sample you can also find on my other repositorys:

https://github.com/fruithost/

@s-ludwig
Copy link
Member

A reference works like this: ![alt text][refImage]

@s-ludwig
Copy link
Member

s-ludwig commented Nov 25, 2024

Also note that an alt text is mandatory as per the HTML spec.

@Bizarrus
Copy link
Author

Bizarrus commented Nov 25, 2024

A reference works like this: ![alt text][refImage]

No, you can't use the Syntax [a][b] or ![a][b]. Some other attributes will be set in the reference.

See the example for Links:
grafik

Here is a live example of Images:

Example:
imageRef

Code:

[![imageRef]](http://example.com/)

[imageRef]: https://placehold.co/100x100 "title"

Rendered:

<a href="http://example.com/" rel="nofollow">
    <img src="https://placehold.co/100x100" alt="imageRef" title="title" data-canonical-src="https://placehold.co/100x100" style="max-width: 100%;">
</a>

The alt attribute is automatically on image references the reference name.

All these examples already also represented on specification:

grafik

@s-ludwig
Copy link
Member

This has nothing to do with the references at the bottom and it has nothing to do with the nesting. The problem is the shortcut syntax you are using (![refImage] instead of ![alt text][refImage]). This is simply not supported by the parser, whereas images, nested links/images and link references are all handled fine.

Supporting this particular syntax, as well as many other details of the CommonMark spec, is certainly a noble goal, but please understand that your issue is addressing the wrong subject.

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

2 participants