Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

mdcat panics if image title is in two lines #194

Closed
laoshaw opened this issue Nov 16, 2021 · 7 comments
Closed

mdcat panics if image title is in two lines #194

laoshaw opened this issue Nov 16, 2021 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@laoshaw
Copy link

laoshaw commented Nov 16, 2021

Not quite sure if this is a mdcat bug: if I split the image line into two lines as below, run mdcat test.md under kitty will abort as shown below.

test.md

![
](my.png)

run mdcat test.md it will report below errors:

thread 'main' panicked at 'Event SoftBreak impossible in state Stacked(StateStack { top_level: TopLevelAttrs { margin_before: Margin }, states: [Inline(InlineText, InlineAttrs { style: Style {}, indent: 0 })] }, RenderedImage)

put test.md above into one line it works fine.

@swsnr
Copy link
Owner

swsnr commented Nov 16, 2021

It probably is; I've never seen this before and it doesn't seem to be part of the common mark test suite, so I don't think mdcat handles this.

I'll perhaps fix this at some point but it'll take time; to me this is a weird corner case so until I actually hit a document with this it's pretty low on my priority list.

If you need to have this fixed any time soon please do open a pull request.

@swsnr swsnr added bug Something isn't working help wanted Extra attention is needed labels Nov 16, 2021
@laoshaw
Copy link
Author

laoshaw commented Nov 16, 2021

I agree, just add why this happens: pandoc converts html to markdown and if an image has a long line, pandoc will break it into two lines and cause mdcat to misbehave, e.g.

! [ this is a super long line whatever asdf asdfsdafsdf fsdfsdfsf sfsdf  sfsdfs sdfsfsdf
and it has to continue to next time](you-image-here)

@norman-abramovitz

This comment was marked as off-topic.

@swsnr
Copy link
Owner

swsnr commented Dec 24, 2022

Can you please fix the formatting of your comment?

I've only skimmed it but the actual error seems to be that images don't get shown in kitty? If so that's a separate problem; please open a new issue for this.

@swsnr
Copy link
Owner

swsnr commented Dec 28, 2022

@norman-abramovitz Friendly ping. Please fix the syntax of your comment; I've hidden it meanwhile.

You might also want to run mdcat --detect-only to check what terminal mdcat assumes you have, because I presume it's wrong: mdcat has a dedicated kitty backend, and thus shouldn't attempt to print iterm commands to kitty terminals.

@norman-abramovitz
Copy link
Contributor

norman-abramovitz commented Jan 3, 2023

Hi,

I was attempting to reproduce the original issue and not introduce a new issue and provide additional information that I found. I will try the detect-only option when I look at this issue again. I do have iterm2 and kitty on my mac, but I do launch them independently. Maybe some env vars getting in the way.

@swsnr
Copy link
Owner

swsnr commented Oct 18, 2023

Closing this, because it doesn't affect me.

@swsnr swsnr closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2023
pengjiz added a commit to pengjiz/mdcat that referenced this issue Aug 3, 2024
Those cases are actually covered in the 'commonmark-spec' test suite.
However, those tests use non-existent images so they are not checked for
rendered images. As such, in this commit we add a new case in
'samples/images.md', primarily to test markups in descriptions of
rendered images.

Re: swsnrGH-194, swsnrGH-285.
swsnr pushed a commit to pengjiz/mdcat that referenced this issue Aug 4, 2024
Those cases are actually covered in the 'commonmark-spec' test suite.
However, those tests use non-existent images so they are not checked for
rendered images. As such, in this commit we add a new case in
'samples/images.md', primarily to test markups in descriptions of
rendered images.

Re: swsnrGH-194, swsnrGH-285.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants