Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| caf932b536 | |||
| fa106c8206 | |||
| 0ac9fd9aaa | |||
| 5bbfb4606d | |||
| 37703e9bab |
@ -73,14 +73,16 @@ def show_html(md_view, preview):
|
||||
lambda href: sublime.run_command('open_url',
|
||||
{'url': href}))
|
||||
|
||||
return
|
||||
# set viewport position
|
||||
# get the "ratio" of the markdown view's position.
|
||||
# 0 < y < 1
|
||||
y = md_view.text_to_layout(md_view.sel()[0].begin())[1] / md_view.layout_extent()[1]
|
||||
# set the vector (position) for the preview
|
||||
vector = [0, y * preview.layout_extent()[1]]
|
||||
# remove half of the viewport_extent.y to center it on the screen (verticaly)
|
||||
vector[1] -= preview.viewport_extent()[1] / 2
|
||||
vector[1] = mini(vector[1], 0)
|
||||
# make sure the minimum is 0
|
||||
vector[1] = 0 if vector[1] < 0 else vector[1]
|
||||
# the hide the first line
|
||||
vector[1] += preview.line_height()
|
||||
preview.set_viewport_position(vector, animate=False)
|
||||
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
"install": "messages/install.txt",
|
||||
"1.1.2": "messages/1.1.2.txt",
|
||||
"2.0.1": "messages/2.0.1.txt",
|
||||
"2.1.1": "messages/2.0.1.txt"
|
||||
"2.2.1": "messages/2.2.0.txt"
|
||||
}
|
||||
|
||||
@ -3,3 +3,6 @@ Sorry to interrupt you... :(
|
||||
A settings is now available: `markdown_live_preview_on_open`. If set to true,
|
||||
it opens the window preview as soon as you open a markdown file. See the
|
||||
README for more infos.
|
||||
|
||||
Tip of the day: `ctrl+w`: closes the current file
|
||||
`ctrl+shift+w`: closes the current window
|
||||
|
||||
8
messages/2.2.0.txt
Normal file
8
messages/2.2.0.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Sorry to interrupt you... :(
|
||||
|
||||
Something changed on MarkdownLivePreview: the preview is now scrolled to where
|
||||
you are editing your markdown file! It doesn't scroll back up all the time any
|
||||
more!
|
||||
|
||||
Tip of the day: You can center the screen on your cursor by pressing:
|
||||
`ctrl+k, ctrl+v` (on OSX `cmd+k, cmd+v`)
|
||||
39
sample.md
39
sample.md
@ -2,7 +2,6 @@
|
||||
|
||||
Hope you'll enjoy using MarkdownLivePreview!
|
||||
|
||||

|
||||
|
||||
```python
|
||||
print('Hello world')
|
||||
@ -13,3 +12,41 @@ if DEBUG:
|
||||
> Only a fool knows everything. A wise man knows how little he knows
|
||||
|
||||
The only think I know right now is that Boxy Theme's just awesome.
|
||||
|
||||
t
|
||||
|
||||
h
|
||||
|
||||
i
|
||||
|
||||
s
|
||||
|
||||
-
|
||||
|
||||
i
|
||||
|
||||
s
|
||||
|
||||

|
||||
|
||||
-
|
||||
|
||||
a
|
||||
|
||||
-
|
||||

|
||||
|
||||

|
||||
|
||||
t
|
||||
|
||||

|
||||
|
||||
|
||||
e
|
||||
|
||||

|
||||
|
||||
s
|
||||
|
||||
t
|
||||
|
||||
Reference in New Issue
Block a user