markdownpreview extension. awwww yeah.

This commit is contained in:
Chris Wanstrath
2011-11-13 23:52:27 -08:00
parent 122df3786b
commit ef55d77610
4 changed files with 1342 additions and 0 deletions

View File

@@ -0,0 +1 @@
module.exports = require 'markdownpreview/markdownpreview'

View File

@@ -0,0 +1,2 @@
editor:
'cmd-ctrl-p': (editor) -> window.open "markdown:#{editor.url}"

View File

@@ -0,0 +1,37 @@
fs = require 'fs'
tdoc = require 'docs/tdoc'
Browser = require 'browser'
{Showdown} = require './showdown'
converter = new Showdown.converter
module.exports =
class Markdownpreview extends Browser
window.resourceTypes.push this
running: true
constructor: ->
atom.keybinder.load require.resolve "markdownpreview/key-bindings.coffee"
open: (url) ->
return false if not url
if match = url.match /^markdown:(.+)/
@url = url
html = '''
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<style>
body { padding:10px; }
code { line-height:16px; }
</style>
'''
html += converter.makeHtml fs.read match[1]
@show html
true

File diff suppressed because it is too large Load Diff