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

Feature Request: Add Captions to Images #514

Open
martyanovandrey opened this issue Sep 18, 2024 · 4 comments
Open

Feature Request: Add Captions to Images #514

martyanovandrey opened this issue Sep 18, 2024 · 4 comments
Labels
easy good first issue Good for newcomers

Comments

@martyanovandrey
Copy link
Contributor

martyanovandrey commented Sep 18, 2024

Description

The current version of YFM allows users to add images with alt-text and title props. To enhance image context and readability, i propose utilizing the figcaption HTML tag for rendering captions.
To enable the display of the caption you need to add the { caption } as attribute, the default value is equal to the title, but it can also be passed in the attribute

Example Syntax

![Alt text](_images/image.png "Caption text" =100x100){ caption }

In this example, the "Caption text" should be rendered within a figcaption tag below the image.

Example HTML Output

The resulting HTML should look like this:

<figure>
    <img src="_images/image.png" alt="Alt text" width="100" height="100" title="Caption text">
    <figcaption>Caption text</figcaption>
</figure>

DOCSTOOLS-3428

@bongiozzo
Copy link
Contributor

Is it possible to use global setting for using Alt text as Caption?

Backward compatibility is understood - so, new setting is needed.

Caption under Image is expected behavior actually. It's most common use, GitBook generates captions this way also.
KISS principle without additional attributes.

@bongiozzo
Copy link
Contributor

https://garrettgman.github.io/rmarkdown/authoring_pandoc_markdown.html

Another markdown which treats [Alt part] as image's caption

@martyanovandrey
Copy link
Contributor Author

Is it possible to use global setting for using Alt text as Caption?

Аlt text has a different meaning and should be used to describe the image. Using alt text to caption images would negatively impact user experience of the documentation from an accessibility perspective.

@martyanovandrey martyanovandrey added good first issue Good for newcomers and removed good first issue Good for newcomers labels Sep 23, 2024
@bongiozzo
Copy link
Contributor

alt text to caption images

It's common practice among popular platforms like gitbook and pandoc.
You may have another implementation, but I told about compatibility, minimalistic approach and global optional setting which changes default behavior and uses Alt as Caption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy good first issue Good for newcomers
Projects
Status: Todo
Development

No branches or pull requests

2 participants