shd101wyy / vscode-markdown-preview-enhanced

One of the "BEST" markdown preview extensions for Visual Studio Code
https://shd101wyy.github.io/markdown-preview-enhanced
Other
1.45k stars 173 forks source link

Can't get line wrapping to work correctly with line numbers enabled #1005

Open p-brane opened 3 years ago

p-brane commented 3 years ago

My markdown file

# Title

Some text here

## Topic 1

@import "./file.yang" {code_block=true class="line-numbers"}

The file.yang has one very long line that soft wraps in the editor perfectly, but does not in the preview. I added the line be;low to my local-style.less file. The long like does not wrap in the preview, but when I create a Chrome (Puppeteer) -> PDF, the line wraps. The numbers continue in sequence through the wrapped lines until they run out at the end and leave four or so lines without line numbers. I would have expected the line numbers to skip the line wraps. Does anyone have a work around for this issue? I can turn off the line number to fix the numbering, but can't tell form the pdf output which lines have been wrapped.

.markdown-preview.markdown-preview {
   @media print {
   // lines here not shown
    pre, code {white-space: pre-wrap;}
   // lines here not shown
}
gronk-droid commented 2 years ago

Having a similar problem: in style.less:

pre, code {
      white-space: pre-wrap;
  }

preview: image

rendered pdf with puppeteer: image

it would be really nice if the newlines were recognized by the line numbers.