在Sublime Text 2中突出显示Github README.md格式 [英] Highlighting Github README.md format in Sublime Text 2

查看:142
本文介绍了在Sublime Text 2中突出显示Github README.md格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有README文件,我希望Sublime仅突出显示某些标签"所标识的部分代码,例如:

I have got README file and I want Sublime to highlight only some pieces of code idented by some "tag", for example:

Here is an example of usage

# This should be highlighted
```ruby
  superhero = Superhero.new
  superhero.make_world_better
```

或使用[code lang=ruby]或其他任何方式

推荐答案

懒惰的答案

(用于独立快速学习者)

Lazy answer

(for independent fast learners)

  1. 安装以下软件包的控件: 崇高的文字.
  2. 重新启动sublime-text后,请参阅快速解答".
  1. Install package control for sublime-text.
  2. Once you restarted sublime-text, see "Fast Answer".


快速答案

(适用于中级至高级sublimetext用户)


Fast answer

(for intermediate to advanced sublime-text users)

  1. Ctrl + Shift + P Package Control: Install Package, 然后安装 Knockdown .

  1. Ctrl+Shift+P and Package Control: Install Package, then install Knockdown.

就是这样,现在您有了一个Set Syntax: Markdown (Github flavored) 触手可及.

That's it, now you have a Set Syntax: Markdown (Github flavored) option right at the reach of your fingertips.


详尽的答案

(无能为力)


Elaborate answer

(powerless to powerfull)

  1. 打开崇高文本.
    [如果您在编辑目录中的文件时需要此功能, 由root或www-data(即/var/www/)拥有,您可能想用admin打开sublime 使用gksu sublime或类似的权限并重复每个步骤]

  1. Open sublime-text.
    [If you need this functionality available when you edit files on a directory owned by root or www-data ( i.e. /var/www/ ) you may want to open sublime with admin privileges using gksu sublime or similar and repeat every step]

通过按 ctr + `
激活崇高的console [即CONTROL键和GRAVE ACCENT键(通常在TAB键上方)]

复制并粘贴以下选项之一,以升华控制台的prompt. (然后按 enter ):

Copy-paste one of the following options to sublime console's prompt. (and press enter):

如果是崇高文字2:

import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

如果是崇高文字3:

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; 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://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

当控制台打印回一条消息"请重新启动Sublime Text以完成安装" (通常几乎是瞬时的)时,关闭sublime.再次打开sublime-text.

Close sublime when the console prints back a message saying "Please restart Sublime Text to finish installation" (usually almost instantaneous). Open sublime-text again.

重新启动sublime-text后,其余的操作很容易,请参见快速解答" (上),或继续阅读.

Once you restarted sublime-text, the rest is easy, see "Fast Answer" (above), or read on.

关于使用包控制

您刚安装的内容会在 Palette 中添加一堆新命令,并为社区贡献插件的美好世界打开了一扇大门.一种由其他人或您自己扩展崇高功能的方法! (共享您的代码!).
现在,使用它来安装knockdown.

About using Package Control

What you just installed adds a new bunch of commands to your Palette and opens the door to a wonderful world of community contributed plugins; a way to extend sublime's functionality by other people or by yourself! (share your code!).
Now lets use it to install knockdown.

  1. 只需按 ctr + shift + P ,然后输入Package Controlpc,即可访问Package Controll ,pack(或其他类似功能,这要归功于命令选项板的模糊搜索功能),在这种情况下,可以通过编写Package Control: Install Package(或仅仅是pi)来搜索正确的命令.
    (如果出现问题,您可以随时 Remove Package ).

  1. You can access Package Controll simply by pressing ctr+shift+P, and typing Package Control, pc, pack (or anything similar thanks to the fuzzy search feature of the command palette), in this case search the right command by writing Package Control: Install Package (or just pi).
    (If something goes wrong you can always Remove Package).

要查看所有可用软件包,只需输入或单击它. Sublime会搜索所有已注册的软件包,甚至会检查并仅向您显示与您的Sublime-text版本兼容的软件包,您将需要等待几秒钟.
(或少于一秒钟,具体取决于您的Internet +计算机延迟+速度).

To see all the available packages just enter or click on it. Sublime will search for all the registered packages and will even check and show for you only the ones that are compatible with your version of sublime-text, you'll have to wait a few seconds.
(or less than a second, depending on your internet+computer latency+speed).

现在搜索并选择knockdown.

点击 Enter 或单击它后,将花一会儿时间进行安装.

After you hit Enter or click on it it will take a brief moment to install.

就是这样它可以正常工作.


(让我们说打开文件")

  1. 在sublime文本中并打开一个.md文件,然后再次按 ctr + shift + P .
  2. 搜索Set Syntax: Markdown (Github Flavored) enter 或单击它.
  1. Inside sublime-text and with a .md file opened, press ctr+shift+P again.
  2. Search for Set Syntax: Markdown (Github Flavored) and enter or click on it.

如果要为所有.md文件激活(这是一个很大的IF)

在当前版本(最新Sublime Text 2版本和任何Ver 3版本)中:
  • 通过以下菜单导航:View -> Syntax -> Open all with current extension as... ->[your syntax choice].
  • IF you want to activate for all .md files (that's a big IF)

    On current version (Latest Sublime Text 2 releases & any ver 3 release):
    • Navigate through the following menus: View -> Syntax -> Open all with current extension as... ->[your syntax choice].
      • 转到Packages/User,创建(或编辑).sublime-settings文件 以要在其中添加扩展名的语法命名, Markdown (Github Flavored).sublime-settings在您的情况下, 在上面写这样的东西:

      • Go to a Packages/User, create (or edit) a .sublime-settings file named after the Syntax where you want to add the extensions, Markdown (Github Flavored).sublime-settings in your case, then write there something like this:

      
      {
          "extensions":
          [
              "md"
          ]
      }
      

      然后重新启动Sublime Text

      And then restart Sublime Text

      (完全有效!这是证据)

      presto!
      您又迈出了第一步,成为一名出色的文字大师,希望我的回答对您有所帮助

      presto!
      You just took one further step to be a sublime-text master, I hope my answer helped you

      这篇关于在Sublime Text 2中突出显示Github README.md格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆