MarkdownLivePreview.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:MarkdownLivePreview 作者: math2001 项目源码 文件源码
def run(self):

        """Inspired by the edit_settings command"""

        current_view = sublime.active_window().active_view()
        file_name = current_view.file_name()
        if get_settings().get('keep_open_when_opening_preview') is False:
            current_view.close()
        if file_name is None:
            return sublime.error_message('MarkdownLivePreview: Not supporting '
                                         'unsaved file for now')

        sublime.run_command('new_window')
        self.window = sublime.active_window()
        self.window.settings().set(PREVIEW_WINDOW, True)
        self.window.run_command('set_layout', {
            'cols': [0.0, 0.5, 1.0],
            'rows': [0.0, 1.0],
            'cells': [[0, 0, 1, 1], [1, 0, 2, 1]]
        })
        self.window.focus_group(1)
        preview = create_preview(self.window, current_view)

        self.window.focus_group(0)
        md_view = self.window.open_file(file_name)
        mdsettings = md_view.settings()

        mdsettings.set(PREVIEW_ENABLED, True)
        mdsettings.set(PREVIEW_ID, preview.id())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号