math2001 / MarkdownLivePreview

A Sublime Text 3 plugin to preview your markdown as you type
https://math2001.github.io/MarkdownLivePreview
MIT License
304 stars 37 forks source link

calculate the width of the preview phantom window #83

Closed ezrafree closed 5 years ago

ezrafree commented 5 years ago

For me the fenced code blocks weren't getting assigned full width. After some digging I found that Sublime Text's minihtml doesn't allow percentage-based units, which means any instances of width: 100%; in the CSS were failing. I then took a look at the code and found that using preview.viewport_extent() I could get the width of the window and output this to an embedded <style> tag in the HTML. This pull request contains my changes to MLPApi.py which fix the issue.