mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Only works for TomDoc'd CoffeeScript right now. Needs to work for all languages. I had to modify handlebars to satisfy 'use strict' Also had to modify the path stuff in tdoc, which works in node but not atom. We need some way to install npm packages or something similar maybe?
24 lines
430 B
CoffeeScript
24 lines
430 B
CoffeeScript
fs = require 'fs'
|
|
|
|
tdoc = require 'docs/tdoc'
|
|
|
|
Browser = require 'browser'
|
|
|
|
module.exports =
|
|
class Docs extends Browser
|
|
window.resourceTypes.push this
|
|
|
|
running: true
|
|
|
|
constructor: ->
|
|
atom.keybinder.load require.resolve "docs/key-bindings.coffee"
|
|
|
|
open: (url) ->
|
|
return false if not url
|
|
|
|
if match = url.match /^docs:\/\/(.+)/
|
|
@url = url
|
|
code = fs.read match[1]
|
|
@show tdoc.html code
|
|
true
|