Skip to content

Commit

Permalink
Make marked linking relative to host
Browse files Browse the repository at this point in the history
  • Loading branch information
jessevdk committed Oct 3, 2014
1 parent ce6cd9c commit ec1d4fc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cldoc/data/javascript/cldoc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions html/coffee/cldoc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ window.cldoc = $.extend($.extend({
})

$(document).ready(->
cldoc.Doc.init()
cldoc.Sidebar.init()
cldoc.Page.route()
)
Expand Down
14 changes: 14 additions & 0 deletions html/coffee/doc.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
class cldoc.Doc extends cldoc.Node
@magic_separator = '%~@@~%'

@init: ->
origproto = marked.InlineLexer.prototype.outputLink

marked.InlineLexer.prototype.outputLink = (cap, link) ->
orighref = link.href

if link.href.match(/^[a-z]+:/) == null && link.href[0] != '/'
link.href = cldoc.host + '/' + link.href

ret = origproto.call(this, cap, link)
link.href = orighref

return ret

constructor: (@node) ->
super(@node)

Expand Down

0 comments on commit ec1d4fc

Please sign in to comment.