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?
21 lines
579 B
CoffeeScript
21 lines
579 B
CoffeeScript
hbar = require './handlebars'
|
|
{Showdown} = require './showdown'
|
|
converter = new Showdown.converter
|
|
|
|
hbar.registerHelper 'format', (comment) ->
|
|
comment = comment+''
|
|
|
|
# param - info => <b>param:</b> info
|
|
comment = comment.replace /(?:^\s*(\S+?)\s+-\s+(.+)$)+/img,
|
|
'<br>**$1:** $2'
|
|
comment = comment.replace '<br>**', '<br><br>**'
|
|
|
|
# markdownize
|
|
comment = converter.makeHtml comment
|
|
|
|
# <pre><code>code</code></pre> => <pre>code</pre>
|
|
comment = comment.replace /<pre><code>((?:.|\n)+)<\/code><\/pre>/img,
|
|
'<pre>$1</pre>'
|
|
|
|
new hbar.SafeString comment
|