         _.extend @current_options, options
       @value @current_options
 
+    LinkComponent = React.createClass
+      render: -> React.DOM.a {href: @props.href}, @props.value
+
     cmd 'permalink', 'Create a link to the code in the input cell above', (code) ->
       a = document.createElement 'a'
+      # TODO app should generate links
       a.href = location.href
       a.hash = null
       code ?= @previously_run()
       a.search = '?' + encodeURIComponent btoa code
-      a.innerText = a.href
-      @add_rendered a
+      @add_component LinkComponent href: a.href, value: a.href
 
     fn 'websocket', 'Runs commands from a web socket', (url) ->
       ws = new WebSocket url

    else
      target.textContent = code

  help = (fns) ->
    documented_fns = (name for name, c of fns when c?.doc?)
    documented_fns.sort()
    $dl = $ '<dl/>'
    for cmd in documented_fns
      $tt = $ '<tt/>'
      $tt.text cmd
      $dt = $ '<dt/>'
      $dt.append $tt
      $dl.append $dt
      $dd = $ '<dd/>'
      $dd.text fns[cmd].doc
      $dl.append $dd
    $dl

  modules.create 'builtins', ({fn, cmd}) ->
    cmd 'help', 'Shows this help', (cmd) ->

  CodeMirror = require 'cm/codemirror'
  require 'cm/runmode'
  URI = require 'URIjs'
  _ = require 'underscore'
  marked = require 'marked'
  modules = require 'modules'
