Git Product home page Git Product logo

markdownlivepreview's Introduction

MarkdownLivePreview

A simple plugin to preview your markdown as you type right in Sublime Text. No dependencies!

How to install

It's available on package control!

Setting a keybinding

The open the preview, you can search up in the command palette (ctrl+shift+p) MarkdownLivePreview: Open Preview. But if you prefer to have a shortcut, add this to your keybindings file:

{
    "keys": ["alt+m"],
    "command": "open_markdown_preview"
}

How to contribute

If you know what feature you want to implement, or what bug you wanna fix, then go ahead and hack! Maybe raise an issue before hand so that we can talk about it if it's a big feature.

But if you wanna contribute just to say thanks, and don't really know what you could be working on, then there are a bunch of FIXMEs all over this package. Just pick one and fix it :-)

$ git clone https://github.com/math2001/MarkdownLivePreview
$ cd MarkdownLivePreview
$ grep -R FIXME

Hack it!

  1. Fork this repo
  2. Make your own branch (the name of the branch should be the feature you are implementing eg. improve-tables, fix-crash-on-multiple-preview
  3. All your code should be formated by black.
  4. Send a PR!

Known limitations

Numbered lists are rendered as unordered lists

1. first
2. second
3. third

will be previewed the exact same way as

- first
- second
- third

The issue comes from Sublime Text's minihtml which doesn't support ordered lists. If you think feel like implementing a workaround, feel free to contribute, but it's not something I'm planning on doing. It isn't a critical feature, and support should come with time...

markdownlivepreview's People

Contributors

jimperio avatar math2001 avatar sepich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

markdownlivepreview's Issues

suggestion

hi ,thanks you develop this plugin!
I hava some suggestions

  • sublime auto preview when open markdow of file. not need press alt+m
  • code and preview should synchronized scrolling

I am sorry for bad english

Image size should adopt to window width

Images unfortunately seem to be displayed in original size and not scaled down to a size that would fit the window. I seem not be able to change this with css since the img property is not supported.
Would be nice if images would dynamically scale to fit the window width.

This is the only thing that is really bothering me apart from this the plugin is very helpful 👍🏻

Crashes after Installation of Package

First time user of Sublime and packages (and beginner in web development in general), but after I followed the installation instructions for the package, the preview does not work and crashes. Attempted to remove the package via Package Control, but it crashes before I can remove it.

I do see this "not a directory" error in the console:
screen shot 2017-01-05 at 9 53 15 pm

No "live" preview, just the first one.

Hello Math,
Thanks for this plugin.

The preview is working well (it opens the two-panels window when I open an md file)

BUT

When I type something in the left one (the md file), the preview is not updating anymore. There is a tiny delay, that proves something is processing, but the preview does not change.

FYI :

  • If I save the file, close the window and open the file once again, the preview is showing up with the last update.
  • I am on windows 7, and using SublimeText 3, build 3126.

An idea about the cause of the issue ?

Font face

Thanks for the great plugin!

I'm attempting to alter the font face. I've tried each of these methods:

MarkdownLivePreview: Edit Custom CSS File:

body {
    font-family: "CMU Serif";
}

I've also tried to target the p selector without effect.

MarkdownLivePreview.sublime-settings -- User:

// Your settings for MarkdownLivePreview. See the default file to see the different options.
{
    "font_face": "CMU Serif",
}

Also without effect.

And finally I tried: MarkdownLivePreviewSyntax.sublime-settings:

{
    "show_menus": false,
    "show_tabs": false,
    "show_minimap": false,
    "gutter": false,
    "rulers": [],
    "word_wrap": true,
    "font_face": "CMU Serif",
}

Where all flags work as expected except for the font face.

How can I change the font face of the preview pane?

Preview files in .sublime-package

Sublime Text 3:版本 3126
mac版本:MacOS Sierra 10.12.6

1.打开插件“AdvancedNewFile”的Readme.md文件时,
2.Alt(option)+M
结果:原文件内容被清空,LivePreview内容也是空白的

Wrong Representation of Lists in Preview

When making a numbered list that is written as:
1.
2.
3.
etc...
the preview shows these first as correct, but once text is added after the period(regardless of if space is left between the period and the first character) it will change the preview to be a bullet point instead the proper number.

Show insert text marker in the preview

I tried writting and looking only directly at the preview and it really works and feels natural, except for there is no insert indicator | (that shows where I'm putting the text down currently).

Would it be possible to show preview only (similar to #22 ), but also show the insert marker? so someone who's accustomed to markdown already would write and look at the preview directly

No preview displayed

When using the package, no preview displayed.
I have tried reinstalling and restarting and I have the same issue.

readme_md

Preview not showing at all

When attempting to edit a markdown file, the live preview pane is not showing anything.

  • Sublime v3 (3143)
  • Windows 7 x64

The console dumps the following error:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 435, in on_load_async
    callback.on_load_async(v)
  File "MarkdownLivePreview in C:\Users\foo\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownLivePreview.sublime-package", line 97, in on_load_async
  File "MarkdownLivePreview in C:\Users\foo\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownLivePreview.sublime-package", line 64, in update
  File "MLPApi in C:\Users\foo\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownLivePreview.sublime-package", line 76, in show_html
  File "MLPApi in C:\Users\foo\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownLivePreview.sublime-package", line 40, in markdown2html
  File "functions in C:\Users\foo\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownLivePreview.sublime-package", line 131, in get_style
  File "functions in C:\Users\foo\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownLivePreview.sublime-package", line 139, in get_resource
  File "C:\Program Files\Sublime Text 3\sublime.py", line 192, in load_resource
    raise IOError("resource not found")
OSError: resource not found

Code blocks highlighting

Is there some way to have the code blocks(e.g. ```javascript) highlighted in the preview tab?

Is it possible to display local images?

Thanks for your efforts, the plugin is really helpful.
I faced with a problem with displaying of local images, I'm getting 404 pictures instead of my ones.
Is it possible to display local images right from the plugin (i.e. file://), or I need to run a local server to serve pictures to it? I took a glance over the documentation but found nothing.

Probably a screenshot might be clarifying a little bit. Pictures are located in the same folder as markdown is and I'm pretty sure names are correct. I've tried to use ./name as well, but it didn't help.

screen shot 2017-02-17 at 10 49 00 am

BUG: Dependency problem occured

Hi.
I manually installed plugin in ST3130... and got this error in ST console:

...
reloading plugin MarkdownLivePreview.image_manager
Traceback (most recent call last):
  File "/usr/lib64/sublime-text-3dev/sublime_plugin.py", line 107, in reload_plugin
    m = imp.reload(m)
  File "/usr/lib64/sublime-text-3dev/python3.3.zip/imp.py", line 276, in reload
    module.__loader__.load_module(name)
  File "", line 584, in _check_name_wrapper
  File "", line 1022, in load_module
  File "", line 1003, in load_module
  File "", line 560, in module_for_loader_wrapper
  File "", line 868, in _load_module
  File "", line 313, in _call_with_frames_removed
  File "/home/user/.config/sublime-text-3/Packages/MarkdownLivePreview/image_manager.py", line 8, in 
    from .functions import *
  File "/home/user/.config/sublime-text-3/Packages/MarkdownLivePreview/functions.py", line 8, in 
    from bs4 import BeautifulSoup, Comment as html_comment
ImportError: No module named 'bs4'
...

It turns out that there are external dependencies to beautifulsoup4 package.

Crashes Sublime Text when trying to show preview tab

It crashes Sublime Text when trying to do anything in the tab the markdown text resides after it has been launched from the Command Palette. Simply launching it does not invoke the crash but neither does it show the preview window. Immediately after clicking into the tab shows another tab (the preview) and the editor goes down blazing (watch it here). Console shows nothing.

Any hints on the possible cause and how to avoid it?

Numbered Lists

When using numbered lists the preview shows bullet points instead of the correct number. Using sublime build 3126 and newest MarkdownLivePreview from packageControl.

markdown

RuntimeError: maximum recursion depth exceeded while calling a Python object

Hi,
at first - thank you for sharing this gem with community!

Too bad, it seems there are some issues with it.
As soon I open up a larger document, entire ST3 screen became messed up (see screenshot below).

ST3 itself reports:

Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 537, in on_deactivated
v = sublime.View(view_id)
File "C:\Program Files\Sublime Text 3\sublime.py", line 707, in init
self.selection = Selection(id)
RuntimeError: maximum recursion depth exceeded while calling a Python object
error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted

Any ideas how to handle this?

Sreenshot:
st3-error

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2729: ordinal not in range(128)

Hi!

I tried to search for a similar bug here, among the issues, but found none. So my problem:

  1. Try to open a markdown file (.mdown)
  2. Hit alt+m (I'm on OSX Sierra 10.12.5)
  3. The Preview tab appears but it's empty

Created a screenshot with the console open:
https://www.dropbox.com/s/h9uesebxft3e65r/Screenshot%202017-07-28%2010.08.29.png?dl=0

Tried with only one h1
https://www.dropbox.com/s/zgvhsbcq3iq80zq/Screenshot%202017-07-28%2010.04.22.png?dl=0

Looked for this error in so, and found something related to python (my python version is 2.7) and character encoding. I'm not sure if it's related to this issue at all, but might help:

https://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte

Can you please let me know what am I doing wrong?

question: open in a tab not in a new window

lovely plugin!
However I'd love to see the preview (optionally) in a new tab instead of a new window. Is it possible by any chance?
The annoying thing is the fact that the source file (I mean the text view) is moved to the new window and when closing the window I also close the source file (as specified in the README).
Is there any workaround? It would be good enough to quickly bring back the source file from the original st3 window

Show only preview without edit (click for edit)

@math2001 awesome plugin! Hard to find in google still but it will catch on I'm sure

It would be great if clicking on markdown file would only open the preview (in new tab). Then just add a button to the very top "Edit", when you click it - it opens the live editing. This would be the best as 90% of the time we still open markdown just to read (or see if anything should be changed) and it's a bit annoying to have popup all the time.

Thanks!

Column Headers not appearing properly

The column headers are not appearing properly. The example below the second column, description does not appear in the preview.

Definition Description
Travel Manager Can have multiple Advantage #s but they are linked on the BX side to create the interrelationship between each of the unique AA #'s.

Image preview

Is it possible to add image preview or sublime has some limitations in this area?

Editing markup brings preview to top of file

When I'm editing the md file, the preview seems to always want to stay at the top of the file. That means if I want to preview what I'm currently typing I have to go over to the preview window and scroll to what I've just entered - then when I keep typing, the preview window jumps back to the top of the file. Is there a possibility of tracking where the user is typing in the md document and syncing the preview window to that position?

FileNotFoundError

Toggle option not available. No functionality.

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 782, in run_
    return self.run()
  File "MarkdownLivePreview in /Users/marksena/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownLivePreview.sublime-package", line 115, in run
  File "MLPApi in /Users/marksena/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownLivePreview.sublime-package", line 99, in clear_cache
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/kv/grcdq8q16c397nkp8p6pj2sw0000gn/T/MarkdownLivePreviewCache.txt'
using gpu buffer for window
Unable to open /Users/marksena/Library/Application Support/Sublime Text 3/Packages/MarkdownLivePreview/.sublime/MarkdownLivePreview.sublime-settings
Unable to open /Users/marksena/Library/Application Support/Sublime Text 3/Packages/User/MarkdownLivePreview.sublime-settings
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 782, in run_
    return self.run()
  File "MarkdownLivePreview in /Users/marksena/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownLivePreview.sublime-package", line 115, in run
  File "MLPApi in /Users/marksena/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownLivePreview.sublime-package", line 99, in clear_cache
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/kv/grcdq8q16c397nkp8p6pj2sw0000gn/T/MarkdownLivePreviewCache.txt'

Installing MarkdownLivePreview 2.3.6 never finishes (also, upgrading it doesn't complete successfully)

Using ST3 build 3126 x64 in win10 x64.
I wanted to upgrade MLP from 2.3.4 to 2.3.6.
First I got: An error occurred while trying to upgrade MarkdownLivePreview. Please restart Sublime Text to finish the upgrade

Then at ST3 restart I got some messages in console which I unfortunately I didn't keep.
Then I uninstalled it, and tried re-installing it,
but its installation never finishes:
it stays at Installing package MarkdownLivePreview.

This is what I I'm constantly getting in console now:

Traceback (most recent call last):
  File "package_control.loader in C:\Users\Kostas\AppData\Roaming\Sublime Text 3\Installed Packages\Package Control.sublime-package", line 444, in do_swap
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\Kostas\\AppData\\Roaming\\Sublime Text 3\\Installed Packages\\0_package_control_loader.sublime-package'
ignored packages updated to: ["ColorHelper", "ConvertToUTF8", "MarkdownLivePreview", "Vintage"]
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
Package Control: The dependency 'bs4' is not currently installed; installing...

I tried closing+restarting ST3 several times, as well as checked in Task Manager that only one SublimeText3.exe instance is running.
Nothing helped.

No edit current file command

Hi,
There is no "Edit current file" command in command Palette, Only "Edit custom CSS file".

Press Option+M or Control+M get nothing either.

2017-12-06 10 43 08

How is this happened?
Is this plugin not able to work with OSX?

Can't seem to preview

Installed the package okay but alt-m doesn't bring up a preview window. Also, MarkdownLivePreview: Edit Current File doesn't show up in Command Palette. The only thing that does show up in Command Palette is MarkdownLivePreview: Edit Custom CSS File.

Using Sublime 3, up-to-date.

Some problems

  • This plugin seems not has code highlight function
    image
  • And if I open md file include hexo's frontmatter this plugin may has been in trouble and will not work! Please fix it !
    image

Synced scrolling doesn't consider image height

Currently, when updating the live preview for a document that includes an image the scroll jumps to the wrong place if editing somewhere in the document below that image. I assume this is because the scroll doesn't include consideration of the image height?

Depending on how difficult this is to fix, another potential solution might be to offer an option to scroll back to the same position in the document that was open before updating the preview, if that is possible? While this doesn't sync the two panes it at least means you can manually choose where to view in the document rather than it jumping to the incorrect place because of the images.

Preview not updated after downloading image.

If remote image resources are added to a markdown file the preview shows a work in progress icon while downloading the file from web. Unfortunately the preview is not automatically updated after finished download. So it looks like download never finishes.

I am using ST3 3139 x64 on Win10.

live preview hides rest of code after image with link

I have a file similar to below and it loads the image, but hides the rest of the text afterward. It only shows the preview correctly if I remove the "img" tag or the "a" tag.


GRcalculator dockerfile

The dockerfile in this container... etc. etc.

LivePreview for UNSAVED file

Would it be possible to use LivePreview for UNSAVED file?
(I'm very often drafting text in SublimeText then copy / paste somewhere else - and not saving these source files.)

wont install

windows 10
install from package control

reloading settings Packages/User/Package Control.sublime-settings
Package Control: The dependency 'bs4' is not currently installed; installing...
Package Control: The dependency 'bs4' is not available
Package Control: The dependency 'bs4' could not be installed or updated
reloading settings Packages/User/Preferences.sublime-settings

shrug

Doesn't show text after HTML comment

Maybe it would be better to remove HTML comments before render as phantom.

# Title

## Another Title

<!-- Comment -->

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Console Output:

 code: Unexpected character
Parse Error: !-- Comment -->
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
 code: Unexpected character

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.