markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

Add rule for image without line break

Open Marcono1234 opened this issue 3 years ago • 1 comments

Description

Often users want images to be displayed on a separate line. They then add a single line break and then the image reference, e.g.:

some text
[My image](image.png)

However, due to Markdown line break handling, this will actually be considered an image which is on the same line as the text. In most cases this renders as desired, but only because Markdown renderer tend to wrap images to the next line if there is not enough space. Viewing the Markdown file on a page with a different width or with a different screen size can suddenly show the image on the same line.

It might therefore be good to flag image references, which follow a non-empty line without a hard line break (e.g. trailing 2 spaces or trailing \). Though, maybe there are corner cases where such behavior is desired.

Example

Test:
![Alt text](https://davidanson.gallerycdn.vsassets.io/extensions/davidanson/vscode-markdownlint/0.45.0/1635486276371/Microsoft.VisualStudio.Services.Icons.Default)

Rendered markdown screenshot

(Have included this as screenshot because GitHub Markdown does not require trailing 2 spaces for line breaks.)

Marcono1234 avatar Dec 29 '21 15:12 Marcono1234

I would also like to have this feature. I cannot find it in the current version as of today. Thanks.

miu007 avatar Oct 10 '23 17:10 miu007