Skip to content

Image link with a title fails to resolve the image path #60

Description

@mapitman

Description

If an image link includes an optional title, mdview treats the title as part of the file path. The image then fails to load.

CommonMark allows a title after the image destination:

![Architecture diagram](images/diagram.png "Architecture diagram")

Steps to reproduce

  1. Create docs/images/diagram.png.

  2. Create docs/example.md with this content:

    # Example
    
    ![Architecture diagram](images/diagram.png "Architecture diagram")
  3. Run mdview docs/example.md.

Expected behavior

mdview resolves the path docs/images/diagram.png and shows the image. The title becomes the image's title attribute.

Actual behavior

mdview prints a warning, and the image does not show:

Warning: Unable to stat image file /path/to/docs/images/diagram.png "Architecture diagram": stat /path/to/docs/images/diagram.png "Architecture diagram": no such file or directory

The quoted title is included in the path that mdview tries to stat.

If the title is removed (![Architecture diagram](images/diagram.png)), the image shows correctly.

Environment

  • mdview 1.8.0
  • macOS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions