Sublime Text3编辑并预览Markdown

安装

  1. 打开sublime,打开Package Controller :Install Package 等待打开
  2. 重复第一步,输入MarkdownPreview 安装
  3. 重复第一步,输入MarkdownEditing 安装
  4. 重复第一步,输入MarkdownLivePreview 安装
  5. 重复第一步,输入LiveReload 安装
  6. 安装完成,在首选项中PackageSettings可以找到Markdown EditingMarkdown Preview
  7. Markdown Editing打开Markdown GFM Settings - DefaultMarkdown 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
}

预览

  1. 要确保已经安装了MarkdownPreview
  2. 新建一个文件,例如命名为 测试.md 注意要自己加上.md后缀,打开文件后sublime会自动切换Markdown语法
  3. ctrl+shift+p输入MarkdownPreview选择Preview in Browser再选择markdown 用浏览器预览
  4. 设置快捷键–首选项-快捷键设置,在右侧添加如下代码
    { "keys": ["ctrl+q"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} },
    keys后面填入对应的快捷键,我设置的是ctrl+q键打开预览网页
    parser后面填入的是预览方式,设置为github的话是使用github在线API解析,我这里选的是本地预览

实时刷新网页上的预览内容

  1. 确保安装了LiveReload
  2. Ctrl+shift+p,输入LiveReload: Enable/disable plug-ins,选择Simple Reload
  3. 在文档保存之后网页就会实时刷新
  4. ctrl+q打开预览网页,保存之后网页刷新
  5. 注意事项:目前发现的一个问题是每次打开sublime需要手动开启一下LiveReload: Enable/disable plug-ins才能自动保存
    在这里插入图片描述
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值