瀏覽代碼

Add Markdown documentation

Thibaut 11 年之前
父節點
當前提交
6bcfd08bb1

二進制
assets/images/icons.png


二進制
assets/images/icons@2x.png


+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -187,6 +187,11 @@ credits = [
     '2009-2013 The Dojo Foundation',
     'MIT',
     'https://raw.github.com/lodash/lodash/master/LICENSE.txt'
+  ], [
+    'Markdown',
+    '2004 John Gruber',
+    'BSD',
+    'http://daringfireball.net/projects/markdown/license'
   ], [
     'MaxCDN',
     '2014 MaxCDN',

+ 4 - 1
assets/javascripts/templates/pages/news_tmpl.coffee

@@ -32,7 +32,10 @@ newsItem = (date, news) ->
   result
 
 app.news = [
-  [ 1404518400000, # July 5, 2014
+  [ 1406419200000, # July 27, 2014
+    """ New <a href="/markdown/">Markdown</a> documentation """,
+  ], [
+    1404518400000, # July 5, 2014
     """ New <a href="/cordova/">Cordova</a> documentation """,
   ], [
     1404172800000, # July 1, 2014

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -45,6 +45,7 @@
         'pages/laravel',
         'pages/less',
         'pages/lodash',
+        'pages/markdown',
         'pages/maxcdn',
         'pages/mdn',
         'pages/moment',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -62,3 +62,4 @@
 ._icon-chai:before          { background-position: -3rem -9rem; }
 ._icon-sinon:before         { background-position: -4rem -9rem; }
 ._icon-cordova:before       { background-position: 0 -10rem; }
+._icon-markdown:before      { background-position: -1rem -10rem; }

+ 7 - 0
assets/stylesheets/pages/_markdown.scss

@@ -0,0 +1,7 @@
+._markdown {
+  padding-left: 1rem;
+
+  h1, h2, h3, h1 + ul { margin-left: -1rem; }
+  h2 { @extend %block-heading; }
+  h3 { @extend %block-label, %label-blue; }
+}

+ 17 - 0
lib/docs/filters/markdown/clean_html.rb

@@ -0,0 +1,17 @@
+module Docs
+  class Markdown
+    class CleanHtmlFilter < Filter
+      def call
+        at_css('h1').content = 'Markdown'
+
+        css('#ProjectSubmenu', 'hr').remove
+
+        css('pre > code').each do |node|
+          node.before(node.children).remove
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 19 - 0
lib/docs/filters/markdown/entries.rb

@@ -0,0 +1,19 @@
+module Docs
+  class Markdown
+    class EntriesFilter < Docs::EntriesFilter
+      def additional_entries
+        type = nil
+
+        doc.children.each_with_object [] do |node, entries|
+          if node.name == 'h2'
+            type = node.content.strip
+          elsif node.name == 'h3'
+            next if type == 'Overview'
+            name = node.content.strip
+            entries << [name, node['id'], type]
+          end
+        end
+      end
+    end
+  end
+end

+ 17 - 0
lib/docs/scrapers/markdown.rb

@@ -0,0 +1,17 @@
+module Docs
+  class Markdown < UrlScraper
+    self.name = 'Markdown'
+    self.type = 'markdown'
+    self.base_url = 'http://daringfireball.net/projects/markdown/syntax'
+
+    html_filters.push 'markdown/clean_html', 'markdown/entries'
+
+    options[:container] = '.article'
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; 2004 John Gruber<br>
+      Licensed under the BSD License.
+    HTML
+  end
+end

二進制
public/icons/docs/markdown/16.png


二進制
public/icons/docs/markdown/16@2x.png


+ 1 - 0
public/icons/docs/markdown/SOURCE

@@ -0,0 +1 @@
+https://github.com/dcurtis/markdown-mark