One - One Code All

Blog Content

sublime编辑器的markdown预览功能Ctrl + Shift + P

Linux-Mac   2020-08-08 14:38:19

设置步骤

1、安装 Package Control(如果已安装,请忽略此步骤)

1)打开控制台

使用 ctrl + 或者View -> show console` 打开控制台。


2)复制下面代码到 console 中(或者去 官网 复制)

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee'+ 
'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; 
ipp = sublime.installed_packages_path(); 
urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); 
by = urllib.request.urlopen( 'http://packagecontrol.io/'+ pf.replace(' ', '%20')).read(); 
dh = hashlib.sha256(by).hexdigest(); 
print('Error validating download (got %s instead of %s), please try manual install'% (dh, h)) 
ifdh != h elseopen(os.path.join( ipp, pf), 'wb').write(by)


2、安装插件

1)ctrl + shift + p 选择 Package Control: Install Packge

2)在插件列表中,选择搜索 markdown preview

3)重复上面两步分别安装 Markdown Editting 和 LiveReload


3、修改配置项

1)将 Markdown Preview 的 enable_autoreload 设置为 true

打开 Preferences – Package Settings – Markdown Preview – Setting,在 user 设置中添加:

{
    "enable_autoreload": true,
}


2)启用 LiveReload

打开 ctrl + shift + p,输入 LiveReload: Enable/disable plug-ins,选择 Enable: Simple Reload。


4、设置预览快捷键

选择 Preferences — Key Bindings-User,将下面的内容添加进去:

{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} }



其他编辑器:

Visual Studio Code 原生就支持高亮Markdown的语法,想要一边编辑一遍预览,有两种方法:

  1. Ctrl + Shift + P 调出主命令框,输入 Markdown,应该会匹配到几项 Markdown相关命令



上一篇:RHSA-2020:1132-中危: python3 安全更新
下一篇:mac使用sublime text注释快捷键

The minute you think of giving up, think of the reason why you held on so long.