安装
- 打开sublime,打开
Package Controller :Install Package
等待打开 - 重复第一步,输入
MarkdownPreview
安装 - 重复第一步,输入
MarkdownEditing
安装 - 重复第一步,输入
MarkdownLivePreview
安装 - 重复第一步,输入
LiveReload
安装 - 安装完成,在首选项中PackageSettings可以找到
Markdown Editing
和Markdown Preview
- 在
Markdown Editing
打开Markdown GFM Settings - Default
和Markdown GFM Settings - User
,default是默认的配置文件,无法修改,只能修改user,我的user配置如下
{
// "color_scheme": "Packages/MarkdownEditing/MarkdownEditor.tmTheme",
// 上面是Markdown默认的白色背景,我嫌太刺眼,改成默认的颜色了
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"draw_centered": false,
"extensions":
[
"*.md",
"mdown",
"txt",
"md"
],
"highlight_line": true,
"line_numbers": true,
"mde.keep_centered": false,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": false,
"word_wrap": true,
"wrap_width": "auto",
"rulers": [],
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": false,
"auto_match_enabled": true,
// Line
"line_numbers": true,
"highlight_line": false,
"line_padding_top": 2,
"line_padding_bottom": 2,
// Caret
"caret_style": "wide", // "wide" is deprecated starting with ST Build 3057.
// In the future, this line will be replaced with:
// "caret_style": "solid",
// "caret_extra_width": 1,
// These will work only in ST Build 3057 and later.
"caret_extra_top": 3,
"caret_extra_bottom": 3,
// add trailing #'s to headlines
"mde.match_header_hashes": false,
// Automatically switches list bullet when indenting blank list item with <Tab>.
"mde.list_indent_auto_switch_bullet": true,
// List bullets to be used for automatically switching. In their order.
"mde.list_indent_bullets": ["*", "-", "+"],
// Auto increments ordered list number. Set to false if you want always "1".
"mde.auto_increment_ordered_list_number": true,
// Always keep current line vertically centered.
"mde.keep_centered": false,
// Distraction free mode improvements. In order for these to work, you have to install
// FullScreenStatus plugin: https://github.com/maliayas/SublimeText_FullScreenStatus
"mde.distraction_free_mode": {
"mde.keep_centered": true
},
"mde.lint": {
"mdl": {
// By default it is mdl.bat on windows and mdl otherwise. Leave it blank to use the default value
// If you are using a custom launcher, you may want to change this
"executable": "",
// Extra arguments passed to mdl. For all options, see here:
// https://github.com/markdownlint/markdownlint/blob/master/lib/mdl/cli.rb
// You can also specify a config file with '-c ~/.mdlrc'
"additional_arguments": []
},
// disabled rules, e.g. "md001".
"disable": ["md013"],
// Options:
// atx, ## title only
// atx_closed, ## title ## only
// setext, title only
// =====
// any, consistent within the document
"md003": "any",
// Options:
// asterisk, * only
// plus, + only
// dash, - only
// cyclic, different symbols on different levels
// and same symbol on same level
// single, same symbol on different levels
// any, same symbol on same level
"md004": "cyclic",
// Number of spaces per list indent. Set to 0 to use Sublime tab_size instead
"md007": 0,
// Maximum line length, Set to 0 to use Sublime wrap_width instead
"md013": 0,
// Disallowed trailing punctuation in headers
"md026": ".,;:!",
// Options:
// one, '1.' only
// ordered, ascending number
// any, consistent within one list
"md029": "any",
// Number of spaces after list markers depending on list type.
// (ordered vs unordered, single-line vs multi-line)
"md030": {
"ul_single": 1,
"ol_single": 1,
// optionally, 3
"ul_multi": 1,
// optionally, 2
"ol_multi": 1
}
},
"mde.wikilinks.markdown_extension": ".md",
"mde.wikilinks.homepage": "HomePage",
"mde.wikilinks.templates": {
"default_page": "templates/PageTemplate.md"
},
// You can opt out some keybinds by setting the corresponding value from 'false' to 'true' (without single-quotes).
// Super key references to a key next to left Alt key. It usually has a Windows logo or "win" or "Command" on it.
// Jump between link/image/footnote reference and definition
// Default keys: (OSX)super+ctrl+shift+l (Linux/Win)ctrl+alt+g
"mde.keymap_disable.reference_jump": false,
// Add a new link
// Default keys: (OSX)super+alt+r (Linux/Win)ctrl+super+r
"mde.keymap_disable.reference_new_reference": false,
// Add a new inline link
// Default keys: (OSX)super+alt+v (Linux/Win)ctrl+super+v
"mde.keymap_disable.reference_new_inline_link": false,
// Add a new inline image
// Default keys: (OSX/Linux/Win)super+shift+k
"mde.keymap_disable.reference_new_inline_image": false,
// Add a new footnote
// Default keys: (OSX/Linux/Win)alt+shift+6
"mde.keymap_disable.reference_new_footnote": false,
// Fold current section
// Default keys: (OSX/Linux/Win)shift+tab
"mde.keymap_disable.fold_section": false,
// Open a panel showing all functions related to folding
// Default keys: (OSX/Linux/Win)ctrl+shift+tab
"mde.keymap_disable.show_fold_all_sections": false,
// Jump to the next heading (any level/same or higher level)
// Default keys: (OSX)super+ctrl/shift+pagedown (Linux/Win)ctrl+shift(+alt)+pagedown
"mde.keymap_disable.goto_next_heading": false,
// Jump to the previous heading (any level/same or higher level)
// Default keys: (OSX)super+ctrl/shift+pageup (Linux/Win)ctrl+shift(+alt)+pageup
"mde.keymap_disable.goto_previous_heading": false,
// List pages the link to the current page
"mde.keymap_disable.list_back_links": true,
// Open the home page
"mde.keymap_disable.open_home_page": true,
// Open the journal
"mde.keymap_disable.open_journal": true,
// Open the page referenced
"mde.keymap_disable.open_page": true,
// Make page reference
"mde.keymap_disable.make_page_reference": true
}
预览
- 要确保已经安装了
MarkdownPreview
- 新建一个文件,例如命名为 测试.md 注意要自己加上.md后缀,打开文件后sublime会自动切换Markdown语法
ctrl+shift+p
输入MarkdownPreview
选择Preview in Browser
再选择markdown
用浏览器预览- 设置快捷键–首选项-快捷键设置,在右侧添加如下代码
{ "keys": ["ctrl+q"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} }
,
keys
后面填入对应的快捷键,我设置的是ctrl+q键打开预览网页
parser
后面填入的是预览方式,设置为github
的话是使用github在线API解析,我这里选的是本地预览
实时刷新网页上的预览内容
- 确保安装了
LiveReload
Ctrl+shift+p
,输入LiveReload: Enable/disable plug-ins
,选择Simple Reload
- 在文档保存之后网页就会实时刷新
ctrl+q
打开预览网页,保存之后网页刷新- 注意事项:目前发现的一个问题是每次打开sublime需要手动开启一下
LiveReload: Enable/disable plug-ins
才能自动保存