Markdown syntax -- how to adding title to image


(Justin Gordon) #1

What is the discourse markdown syntax to add a title to an image?

(Mittineague) #3

I recenently asked in another topic but the question hasn’t been answered yet.

(Justin Gordon) #4

I was actually looking for how to do the lightbox title.

(Sam Saffron) #5

@zogstrip do we have provisions for this, what happens if you enter the image tag manually and set title ?

(Jeff Atwood) #6

Why, adding title already works with existing Markdown syntax.

(Justin Gordon) #7

That title is just a mouseover. I don’t think it would work on mobile.

I’m interested in placing a static title under each picture here:

(Régis Hanol) #8

It works as expected :wink:

(Benjamin Kampmann) #9

I know some text-pre-processors have support for image labeling, but then again, markdown isn’t Latex on purpose.

What I am currently thinking is that this could easily be a (JS) plugin, which reads the “title”-tag of an image in the cooked-data and wrap each one into the appropriate <figure><figcaption></figcaption></figure>-tags. Then throw some CSS as it to make it look pretty and there you go.

That said. Can’t we already do this even? Here is what this

<figure><img src='//'><figcaption>The discourse logo</figcaption></figure>

looks like rendered:

The discourse logo

look at that. HTML5 is just awesome.

(Rahul Dhingra) #10

Is there any way to add caption to “pasted image” ? I tried “title” & “alt” tags but nothing works

(Jeff Atwood) #11

The only way at the moment is to not paste, but upload a file (or drag and drop) – the filename will be displayed. Like so:

Pasted images will always say “pasted image”, but uploaded or drag-n-drop files will show the filename in the lightbox.