SublimeText下写作利器之MarkdownEditing

时间:2022-05-06
本文章向大家介绍SublimeText下写作利器之MarkdownEditing,主要内容包括MarkdownEditing:Sublime Text的Markdown利器、关于特性:、关于快捷键:、关于配置:、小小总结:、基本概念、基础应用、原理机制和需要注意的事项等,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。
之前有陆续学习和整理关

对程序员来讲,写作其实是一件非常有益的事情。这一点不少业界大牛对此已有很深刻的阐述和倡导,比如这里~吐血推荐文章集锦收录了那些精辟论述;而SublimeText和Markdown结合无疑是一个魔幻的组合。虽然,Markdown在MAC或Win下都有非常多的IDE,比如个人用过的MarkdownPad 作业部落 简书等,还有Chrome 插件马克飞象 MAC下的Ulysses Mou云云。月光博客的好用的Markdown编辑器一览对这些有过更详细的总结。但是,对于程序员来讲,SublimeText下蛮多插件支持Markdown写作无疑很棒,如此编码写作,就不用在各个IDE间切换,且享受SublimeText精巧性感如斯,岂是不美?

MarkdownEditing:Sublime Text的Markdown利器

Github项目地址:SublimeText-Markdown/MarkdownEditing

关于安装:

如果Sublime安装了Package Control,直接Command+Shift+P(Mac下)输入MarkdownEditing,搜索到点击即可自行安装,重启便可使用用。

关于特性:

MarkdownEditing 从视觉和便捷性上针对 Markdown 文档的编辑进行了一系列的优化。具体如下(Mac下):

  • 安装后针对 mdmdownmmdtxt 格式文件启用插件。颜色方案仿 Byword及iA writer。
  • 自动匹配星号(*)、下划线(_)及反引号(`),选中文本按下以上符号能自动在所选文本前后添加配对的符号,方便粗体、斜体和代码框的输入。
  • 直接输入配对的符号后按下退格键(backspace),则两个符号都会被删除;直接输入配对的符号后按下空格键,则会自动删除后一个。
  • 对“选中文字后输入左括号”这一动作进行了调整,以便插入markdown链接。
  • 拷贝一个链接,选中文本后按下 ⌘⌥V 会自动插入内联链接。
  • 拷贝一个链接,选中文本后按下 ⌘⌥R 会自动插入引用链接。
  • ⌘⌥K 插入链接;⌘⇧K 插入图片。
  • ⌘⇧B⌘⇧I 分别用于加粗体和斜体。
  • ⌘^1..6 对于选中的内容前加对应个数#,即对选中内容字体大小设置为h1~h6;
  • ⌘⇧6插入文档脚注并且跳转到它的定义;具体可参见:Footnotes;
  • 选中文本后按下 # 会自动在文本前后进行配对,可重复按下来定义标题级别。

关于快捷键:

无快捷键的编写,即便是Markdown也略显蛋疼。特性中已经对快捷编写有了说明;下面是MarkdownEditing官方给出的三大平台默认Key Bindings说明与对比:

OS X

Windows/Linux

Description

⌘⌥V

CtrlWinV

Pastes the contents of the clipboard as an inline link on selected text.

⌘⌥R

CtrlWinR

Pastes the contents of the clipboard as a reference link.

⌘⌥K

CtrlWinK

Inserts a standard inline link.

⌘⇧K

ShiftWinK

Inserts an inline image.

⌘⌥B ⌘⌥I

CtrlShiftB CtrlShiftI

These are bound to bold and italic. They work both with and without selections. If there is no selection, they will just transform the word under the cursor. These keybindings will unbold/unitalicize selection if it is already bold/italic.

⌘^1…6

Ctrl1…6

These will add the corresponding number of hashmarks for headlines. Works on blank lines and selected text in tandem with the above headline tools. If you select an entire existing headline, the current hashmarks will be removed and replaced with the header level you requested. This command respects the mde.match_header_hashes preference setting.

⌘⇧6

CtrlShift6

Inserts a footnote and jump to its definition. If your cursor is in a definition, it will jump back to the marker.

⌥⇧F

AltShiftF

Locates footnote markers without definitions and inserts their markers for the definition.

⌥⇧G

AltShiftG

Locates link references without definitions and inserts their labels at the bottom for the definition.

关于配置:

有些快捷键可能与系统的一些发生冲突,可以编辑 ~/Library/Application Support/Sublime Text/Packages/MarkdownEditing/Default (OSX).sublime-keymap 改掉。

另外还有一些设置可以在 ~/Library/Application Support/Sublime Text 2/Packages/MarkdownEditing/Markdown.sublime-settings 中进行修改。

比如除了默认的颜色主题外,MarkdownEditing 还提供了一个高亮显示编辑行 MarkdownEditor-Focus,就可以在 Markdown.sublime-settings 这个文件中找到并去掉注释保存生效。

小小总结:

如何对SublimeText本身能够有一个良好的运用,外加上些许插件的组合,无疑可以让SublimeText下编码和下作变得专注且舒适。之前有总结一篇如何优雅地使用Sublime Text,对自己效率和强迫症改善颇多;毕竟东西不少,还有待持续学习和更新。

当然SublimeText下面,关于Markdown的插件不止这一款;最初在Win下,就用过markdown preview;也是很棒,具体可以参见之前的一篇文章~Sublime text 下的Markdown写作;而更多如MarkdownTOC , Monokai Extended & Markdown Extended等等@太极儒在 Sublime 中配置 Markdown 环境一文中都有叙述,当然也提到了Pandoc(这个略屌,可将Markdown文章一命令转换成多种格式如Txt,Doc,PDF)这个神器。MacPlay则在近乎完美的 Markdown 写作体验 - Sublime Text 3 + OmniMarkupPreviewer一文中详细的阐述了OmniMarkupPreviewer的各种美好。生活,行简单以过;折腾,为简单而生!喜欢折腾的朋友肯定能体会到个中益理!

更多Markdown编辑器文章: 每周一软之 Markdown 笔记软件 Ulysses II More Elegant Use Markdown

参考的那些链接: