├── .travis.yml
├── info.plist
├── Tests
└── Italics.mdown
├── Preferences
└── TM_MARKDOWN.tmPreferences
├── Snippets
└── Code block.tmSnippet
├── LICENSE.txt
├── Syntaxes
├── Markdown (GitHub Italics).tmLanguage
└── Markdown (GitHub).tmLanguage
├── README.md
└── Support
└── bin
└── redcarpet.rb
/.travis.yml:
--------------------------------------------------------------------------------
1 | script:
2 | - xmllint --valid *.plist */*.tm* >/dev/null
3 | - ruby -c */*/*.rb
4 | addons:
5 | apt:
6 | packages:
7 | # Needed for `xmllint`.
8 | - libxml2-utils
--------------------------------------------------------------------------------
/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | contactEmailRot13
6 | zvxr@zvxrzpdhnvq.pbz
7 | contactName
8 | Mike McQuaid
9 | description
10 | GFM syntax highlighting and preview.
11 | name
12 | Markdown (GitHub)
13 | uuid
14 | A9CF0E77-E848-417C-90F4-77E1231FF1B9
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Tests/Italics.mdown:
--------------------------------------------------------------------------------
1 | # Should Match
2 |
3 | _italic_
4 |
5 | _italic italic_
6 |
7 | _italic_regular
8 |
9 |
10 | # Should Not Match
11 |
12 | regular_regular_regular
13 |
14 |
15 | # Should Not Match But Does
16 |
17 | regular _italic_regular
18 |
19 |
20 | # Other Cases (Should not match)
21 |
22 | __double underscores__
23 |
24 | _raw_
25 |
26 | raw_raw_raw
27 |
28 | Lorem `ipsum_dolor_sit` amet
29 |
30 |
31 | # Exceptional Cases
32 |
33 | $$y_i = \alpha_{j[i]} + \beta x_i + \epsilon_i$$
34 |
35 | This is MathJax code which should be parsed separately, but shows just how loose the main spec is about what can be in italic.
--------------------------------------------------------------------------------
/Preferences/TM_MARKDOWN.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | TM_MARKDOWN
7 | settings
8 |
9 | shellVariables
10 |
11 |
12 | name
13 | TM_MARKDOWN
14 | value
15 | eval '${TM_BUNDLE_SUPPORT/'/'\''/g}/bin/redcarpet.rb'
16 |
17 |
18 |
19 | uuid
20 | 1DC6BEA7-C742-45CE-92D7-8F69D914DC93
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Snippets/Code block.tmSnippet:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | content
6 | \`\`\`${1|ada,adb,ads,antlr,applescript,bash,bib,c,c#,c++,cmake,cpp,csharp,css,dot,fish,g4,go,groovy,grt,gtpl,gv,gvy,haskell,hs,html,inc,java,javascript,jruby,js,json,latex,lua,macruby,make,Makefile,Markdown,matlab,md,node,ocaml,octave,perl,php,pl,prolog,py,python,r,R,rake,rb,rbx,ruby,rusthon,scpt,sh,shell,sparql,sql,swift,tcl,Tcl,tex,vhd,vhdl,VHDL,xhtml,yaml,yml,zsh|}
7 | $0
8 | \`\`
9 | name
10 | Insert Code Block
11 | scope
12 | text.html.markdown
13 | tabTrigger
14 | `
15 | uuid
16 | 801405C3-C14D-4C1D-8353-AF6A54FED3D8
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (C) 2015 by Mike McQuaid
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Syntaxes/Markdown (GitHub Italics).tmLanguage:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | fileTypes
6 |
7 | hideFromUser
8 |
9 | injectionSelector
10 | L:(text.html.markdown - (markup.italic.markdown | markup.bold.markdown | markup.raw))
11 | name
12 | Markdown (GitHub Italics)
13 | patterns
14 |
15 |
16 | captures
17 |
18 | 1
19 |
20 | name
21 | punctuation.definition.italic.markdown.github
22 |
23 |
24 | comment
25 | This rule matches underscores inside words to avoid italicizing partial words
26 | (the grammar gets injected into the main Markdown grammar, so its rules have higher
27 | precedence and thus prevent the main Markdown grammar’s pattern for italic text from
28 | matching these underscores.)
29 | match
30 | (?<=\w)(_)(?=\w)
31 | name
32 | markup.other
33 |
34 |
35 | scopeName
36 | text.html.markdown.github
37 | uuid
38 | 8CD0FA72-F70B-446E-9B6B-A79FC90639EE
39 |
40 |
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GitHub-Markdown.tmbundle
2 | Provides some [GitHub Flavoured Markdown](https://help.github.com/articles/github-flavored-markdown/) extensions for TextMate to make working with GitHub Flavoured Markdown nicer.
3 |
4 | ## Features
5 | - Add a new "Preview" command (overriding the existing Markdown preview) using [Redcarpet](https://github.com/vmg/redcarpet) to render GitHub Flavoured Markdown
6 | - Support triple-backtick raw blocks and support syntax highlighting for various languages (others can be added trivially). There’s also a tab trigger for inserting raw blocks: Just type a single backtick (`) and then hit the tab key.
7 | - Support and highlight GitHub Flavoured Markdown strikethroughs, tables, references, checkboxes and italics
8 |
9 | You can also use nicer fonts by installing the [GitHub Flavoured Markdown Font Settings bundle](https://github.com/mikemcquaid/GitHub-Markdown-Font-Settings.tmbundle).
10 |
11 | ## Installation
12 |
13 | Check "Markdown (GitHub)" in TextMate 2's Preferences' Bundles.
14 |
15 | Alternatively:
16 | ```bash
17 | mkdir -p ~/Library/Application\ Support/TextMate/Bundles
18 | cd ~/Library/Application\ Support/TextMate/Bundles
19 | git clone https://github.com/mikemcquaid/GitHub-Markdown.tmbundle
20 | ```
21 |
22 | ## Status
23 | The above features are tested and working for my day-to-day.
24 |
25 | Tested using TextMate 2. May work in TextMate 1 or Sublime Text; I've no idea.
26 |
27 | [Patches welcome](https://github.com/mikemcquaid/GitHub-Markdown.tmbundle/pulls).
28 |
29 | ## Maintainers
30 | Currently maintained by [@noniq](https://github.com/noniq), originally created and maintained by [@MikeMcQuaid](https://github.com/MikeMcQuaid)
31 |
32 | ## License
33 | GitHub-Markdown.tmbundle is licensed under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). The full license text is
34 | available in
35 | [LICENSE.txt](https://github.com/mikemcquaid/GitHub-Markdown.tmbundle/blob/master/LICENSE.txt).
36 |
--------------------------------------------------------------------------------
/Support/bin/redcarpet.rb:
--------------------------------------------------------------------------------
1 | #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
2 | # Usage: markdown-github.rb [...]
3 | # Convert one or more GitHub Flavored Markdown files to HTML and print to
4 | # standard output. With no or when is "-", read GitHub Flavored
5 | # Markdown source text from standard input.
6 |
7 | if ARGV.include?("--help")
8 | File.read(__FILE__).split("\n").grep(/^# /).each do |line|
9 | puts line[2..-1]
10 | end
11 | exit 0
12 | end
13 |
14 | require "rubygems"
15 |
16 | begin
17 | require "redcarpet"
18 | require "pygments"
19 | rescue LoadError
20 | puts <<-EOS
21 |
Please install the Redcarpet and Pygments.rb RubyGems by running the following:
22 |
23 |
/usr/bin/gem install --user redcarpet pygments.rb
24 | EOS
25 | exit 0
26 | end
27 |
28 | class PygmentsSmartyHTML < Redcarpet::Render::HTML
29 | include Redcarpet::Render::SmartyPants
30 |
31 | def block_code(code, language)
32 | language ||= "text"
33 | Pygments.highlight(code, :lexer => language)
34 | rescue
35 | Pygments.highlight(code, :lexer => "text")
36 | end
37 | end
38 |
39 | def checkbox_html(checked)
40 | "