1. 程式人生 > >Sublime Text 3打造markdown編輯器

Sublime Text 3打造markdown編輯器

編輯外掛

Markdown Editing

預覽外掛

Markdown Preview

這個外掛不能實時預覽,但可以設定快捷鍵在瀏覽器中預覽,在Preferences->Key Binding設定裡新增以下程式碼

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

在編輯markdown檔案時可以通過按alt+m快速在瀏覽器中預覽,雖然不如實時預覽方便,但markdown的格式很簡單,經常用的人並不需要頻繁的預覽,設計markdown的初衷本就是為了讓編輯安心碼字,不用過多考慮格式的問題.

MarkdownLivePreview

這個外掛可以實現實時預覽,在Preferences->Package Setting>MarkdownLivePreview>Settings的user配置檔案,設定在開啟時同步預覽:

// Your settings for MarkdownLivePreview. See the default file to see the different options. 
{
    // As soon as you open a markdown file, it opens the window preview
    "markdown_live_preview_on_open
": true, // If an image starts with one of those strings, then it will be loaded from internet "load_from_internet_when_starts": ["http://", "https://"], // When the preview is opened, the markdown file is closed in the origin window and reopend in // the preview window. If this option is set to 'true', then the markdown file will NOT be // closed in the origin window "keep_open_when_opening_preview
": false, // Choose what to do with YAML/TOML (---/+++ respectively) headers // Valid values: "wrap_in_pre", "remove". "header_action": "wrap_in_pre", // Wait at least the specified *seconds* before updating the preview. "update_preview_every": 0 }

這個外掛有可時候可能並不work,所以推薦第一個Markdown Preview。