David Chambers avatar David Chambers committed ceb9305

replace Showdown with marked

Comments (0)

Files changed (7)

 ^hashify[.]css$
+^marked/
 files = [
   'prettify.js'
   'base64/base64.js'
-  'showdown/lib/showdown.js'
-  'showdown/lib/datetimes.js'
-  'showdown/lib/abbreviations.js'
+  'marked/lib/marked.js'
   'hashify-editor/hashify-editor.js'
   'src/settings.coffee'
   'src/utils.coffee'
           <li><a href=https://bitbucket.org/davidchambers/base64.js>Base64</a></li>
           <li><a href=https://bitbucket.org/davidchambers/hashify.me>Hashify</a></li>
           <li><a href=https://bitbucket.org/davidchambers/hashify-editor>Hashify Editor</a></li>
+          <li><a href=https://github.com/chjj/marked>marked</a></li>
           <li><a href=http://code.google.com/p/google-code-prettify/>Prettify</a></li>
-          <li><a href=http://davidchambers.bitbucket.org/showdown/>Showdown</a></li>
         </ul>
         <p>Copyright 2011 <a href=http://twitter.com/davidchambers>David Chambers</a>.</p>
       </div>
           files = [
             '/prettify.js',
             '/base64/base64.js',
-            '/showdown/lib/showdown.js',
-            '/showdown/lib/datetimes.js',
-            '/showdown/lib/abbreviations.js',
+            '/marked/lib/marked.js',
             '/hashify-editor/hashify-editor.js',
             '/lib/settings.js',
             '/lib/utils.js',

src/document.coffee

-{convert, subscribe} = Hashify.utils
+{subscribe} = Hashify.utils
 
 extractTitle = (text) ->
   div = document.createElement 'div'
-  div.innerHTML = convert text.match(/^.*$/m)[0]
+  div.innerHTML = marked text.match(/^.*$/m)[0]
   div.textContent
 
 subscribe 'pre:render', (text, setEditorValue) ->

src/highlight.coffee

 subscribe 'post:render', ->
   # Apply syntax highlighting unless instructed otherwise.
   return if components().query.contains 'prettify:no'
-  node.className = 'prettyprint' for node in nodeList
+  for node in nodeList when /^lang-/.test node.className
+    node.className += ' prettyprint'
   do prettyPrint

src/initialize.coffee

 {bitlyLimit, root} = Hashify.settings
-{$, convert, decode, publish, sendRequest, subscribe} = Hashify.utils
+{$, decode, publish, sendRequest, subscribe} = Hashify.utils
 
 markup = $('markup')
 
 subscribe 'render', (text) ->
-  markup.innerHTML = convert text
+  markup.innerHTML = marked text
 
 subscribe 'editor:resized', (width) ->
   markup.style.marginLeft = width + 'px'
   else if el.attachEvent
     el.attachEvent "on#{type}", handler
 
-convert = (new Showdown 'datetimes', 'abbreviations').convert
-
 decode = (text) ->
   try Hashify.decode text
   catch error
   s args... for s in subscriptions["post:#{event}"] or []
   return
 
-Hashify.utils = {$, addEvent, convert, decode, publish, sendRequest, subscribe}
+Hashify.utils = {$, addEvent, decode, publish, sendRequest, subscribe}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.