Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkdownLivePreviewSyntax.sublime-settings::"word_wrap": true not functioning #34

Closed
william-voyek opened this issue Aug 19, 2017 · 18 comments

Comments

@william-voyek
Copy link

I have added the "word_wrap":true setting to my syntax specific settings file but the preview is still not wrapping:

screenshot 2017-08-18 21 49 22

My settings file:

// These settings override both User and Default settings for the MarkdownLivePreviewSyntax syntax
{
    "show_tabs": true,
    "word_wrap": true
}
@wangray
Copy link

wangray commented Aug 26, 2017

I have the same issue.

@bkarlson
Copy link

same, preview window not wrapping, a bit frustrating

@math2001
Copy link
Owner

Hum... Looked into it and it's a bit weird. Word wrap is on, it's just not wrapping properly.

Can you please do the following:

  1. Open a preview window
  2. click on the tab of the preview (if you press ctrl+p, it should open on the preview's pane)
  3. Go into the View menu, and see if the Word Wrap option is enabled.

In my case, it is, but wrapping the Phantom (the preview thing) doesn't seem to take into account the minimap, and to wrap properly at all.

@bkarlson
Copy link

bkarlson commented Sep 29, 2017

partial fix via custom css:

body {
    font-family: Verdana, "Open Sans", sans-serif;
    font-size: 13px;
    width:550px; /* adjust to your liking */
}

Links are still nor wrapped neither highlighted (will open a separate issue)

@bkarlson
Copy link

Sorry, @math2001 , just noticed your prompt response. Yes, word wrap is enabled for both windows, still no avail:
image

@math2001
Copy link
Owner

So, I guess that's Sublime's problem, with the Phantom. I'll look into it a bit more (I feel like images and pre tags might cause those bugs...)

@bkarlson
Copy link

bkarlson commented Oct 1, 2017

Yes, you're right, it's overly wide images & unbroken lines within tt or code elements that cause whole document to become too wide.
Easy fix for img via custom css:

img {width:680px}

(distorts images, but still)
Yet no fix for code blocks, minihtml is way too limited in my view. See if you can come up with a better idea

@math2001
Copy link
Owner

math2001 commented Oct 1, 2017

Does it work? width isn't mentionned in the minihtml reference...

Did you try witdth: 100% and/or max-width: 100%?

@bkarlson
Copy link

bkarlson commented Oct 1, 2017

Yep, tried 100%, seems like it interpreted as 100px 😬
See my current CSS below, at least it contains overall doc width within my panel width, but long lines in<tt> still remain unbroken and hang like hell, see below. Images are distorted, as height:auto is ignored, but at least I can see them w/o scrolling horizontally as width is fixed.

body {
    font-family: Verdana, "Open Sans", sans-serif;
    font-size: 13px;
   background-color:white;
   width: 680px;
}

html {
   background-color:white;
    --light-bg: color(var(--background) blend(#eee 85%));
    --very-light-bg: color(var(--background) blend(#eee 92%));
}

img {width:680px}

image

@mrpinghe
Copy link

mrpinghe commented Dec 6, 2017

Seeing the same bug. A bit more tweaking shows that if you put the full URL directly without any link text in the markdown file, it messes up the wrapping. So if you use markdown to shorten that URL when preview, i.e. [link text](your full URL) in markdown, the preview would be all wrapping correctly

Hope that is helping somebody

@seamusdemora
Copy link

I have the same issue. It seems this bug has been around for a while ( > 9 months now). The fact that it's not been fixed suggests the project has died... too bad - it's a good idea, but I just don't think this is a useful app if the preview doesn't wrap.

@ixjx
Copy link

ixjx commented Jun 4, 2018

+1 ,the same issue.
It seems the bug does not fixed up to now :(

@xiebruce
Copy link

xiebruce commented Mar 6, 2019

+1, seems not fix yet?

@omaralamoudi
Copy link

+1. No fix yet?

@rafaelbeckel
Copy link

+1

@math2001
Copy link
Owner

I think I understand what the problem is: the image is too large, so it grows the preview. Otherwise, wrapping works.

So, this will be fixed with #48, so I'm closing this. (Feel free to re-open if you disagree)

math2001 added a commit that referenced this issue Nov 16, 2019
It didn't look pretty when images where larger than the viewport, and it
"broke" word wrap (because it stretched the phantom, and hence lines
wrapped further, see #34)

Sublime Text's minihtml only supports width and height attributes on
img tags, therefore, we have to determine the aspect ratio of the images
ourselves if we want to set a maxsize (so that we can set the height).

We use a hacky function copy pasted from stackoverflow to determine the
size of common format of images using std lib python.
@Ganthark
Copy link

I still have this issue, is the fix released in the version available on package control?

@Anesthesius
Copy link

I still have this issue, is the fix released in the version available on package control?

I also have this issue when code blocks extend beyond the margins of the preview. If I manually add enough line-breaks to the code block so it doesn't extend beyond the margins of the preview, wrap works correctly again.

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

No branches or pull requests