Skip to content

Bug: inline images are not being exported to Markdown at all (verified in playground) and image captions are not exported to Markdown/DOM (instead some other text is used in alt) #5474

@vadimkantorov

Description

@vadimkantorov

I went to https://playground.lexical.dev/, inserted an inline image, it gets displayed okay. I then press the button for converting to Markdown. The markdown string contains no info about the image.

I understand that there often is no 1:1 correspondence between the JSON editor state and markdown, but images (inline or URL-based) can somehow be represented by markdown (e.g. by slightly abusing Markdown and using datauri in the ![](imagedatauri) syntax or by returning a dictionary of attachment files along with markdown string which are then addressed by image tags)

I've checked, regular "Insert Image" (non-inline) gets converted to markdown using the datauri syntax, but somehow inline image is not. I think it'd be better in this case to trim the precise inline formatting and still preserve the presence of image instead of the current behavior of completely stripping the image (probably a markdown transformer for InlineImageNode would need to be added to packages/lexical-playground/src/plugins/MarkdownTransformers/index.ts).

( Basically, I'm looking to create some basic rich-text editor like https://telegra.ph (quill-based), but using markdown + file attachments as backend (e.g. thing a GitHub repo containing images and markdown files) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions