Skip to content

Embedding image in a figure element with a figcaption #573

@svennerberg

Description

@svennerberg

I'm struggling with how to do this:

<figure class="is-left">
  <img src="image.jpg" alt="alt text">
  <figcaption>Caption for image goes here</figcaption>
</figure>

The things I want to achieve here is to:

  • upload an image
  • put it inside a figure element in the document
  • be able to set a class on the figure element (for example is-left, is-centered, is-right)
  • be able to write a caption for the image
  • be able to add an alt-text for the image

I guess it involves creating a schema for <figure> but I have a hard time understanding how schemas work in general and with nested elements in particular.

Has anyone done something similar to this and/or have some example code to show? I would really appreciate any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions