mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add the Jekyll docs
This commit is contained in:
parent
8eb8a9e46d
commit
2bd96af5c0
8 changed files with 155 additions and 0 deletions
|
@ -55,6 +55,7 @@
|
|||
'pages/github',
|
||||
'pages/go',
|
||||
'pages/haskell',
|
||||
'pages/jekyll',
|
||||
'pages/jquery',
|
||||
'pages/julia',
|
||||
'pages/knockout',
|
||||
|
|
35
assets/stylesheets/pages/_jekyll.scss
Normal file
35
assets/stylesheets/pages/_jekyll.scss
Normal file
|
@ -0,0 +1,35 @@
|
|||
._jekyll {
|
||||
h2, h3 { @extend %block-heading; }
|
||||
|
||||
.note {
|
||||
@extend %note;
|
||||
|
||||
h5 {
|
||||
margin-top: 0.25em;
|
||||
}
|
||||
|
||||
position: relative;
|
||||
&::after {
|
||||
content: attr(data-type);
|
||||
opacity: 0.5;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 0.25em;
|
||||
right: 0.5em;
|
||||
font-size: 0.8em;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// Other note types currently unstyled:
|
||||
// plain
|
||||
// tip
|
||||
// feature
|
||||
&.note-info { @extend %note-blue; }
|
||||
&.note-warning { @extend %note-red; }
|
||||
&.note-unreleased { @extend %note-orange; }
|
||||
}
|
||||
|
||||
pre {
|
||||
font-size: inherit;
|
||||
}
|
||||
}
|
55
lib/docs/filters/jekyll/clean_html.rb
Normal file
55
lib/docs/filters/jekyll/clean_html.rb
Normal file
|
@ -0,0 +1,55 @@
|
|||
module Docs
|
||||
class Jekyll
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.improve, .section-nav').each(&:remove)
|
||||
|
||||
css('div.highlighter-rouge').each do |node|
|
||||
pre = node.at_css('pre')
|
||||
|
||||
# copy over the highlighting metadata
|
||||
match = /language-(\w+)/.match(node['class'])
|
||||
# HACK: Prism shell highlighting highlights `|`,
|
||||
# which makes the tree on this page look terrible
|
||||
if match && !(slug == /structure/ && match[1] == 'sh')
|
||||
lang = match[1]
|
||||
if lang == 'sh'
|
||||
lang = 'bash'
|
||||
elsif lang == 'liquid'
|
||||
lang = 'django' # Close enough.
|
||||
end
|
||||
pre['class'] = nil
|
||||
pre['data-language'] = lang
|
||||
end
|
||||
|
||||
# Remove the server-rendered syntax highlighting
|
||||
code = pre.at_css('code')
|
||||
code.content = code.text
|
||||
|
||||
# Remove the div.highlighter-rouge and div.highlight wrapping the <pre>
|
||||
node.add_next_sibling pre
|
||||
node.remove
|
||||
end
|
||||
|
||||
css('code').each do |node|
|
||||
node['class'] = ''
|
||||
end
|
||||
|
||||
css('.note').each do |node|
|
||||
node_type = /note ?(\w+)?/.match(node['class'])[1] || 'tip'
|
||||
|
||||
# <div class="note">...<br>...</div> -> <div class="note">...</div>
|
||||
(node > 'br').each(&:remove)
|
||||
# <div class="note">...<p>...<br><br>...</p>...</div> ->
|
||||
# <div class="note">...<p>...<br>...</p>...</div>
|
||||
node.css('br + br').each(&:remove)
|
||||
|
||||
node['class'] = "note note-#{node_type}"
|
||||
node['data-type'] = node_type
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
29
lib/docs/filters/jekyll/entries.rb
Normal file
29
lib/docs/filters/jekyll/entries.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
module Docs
|
||||
class Jekyll
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
if /continuous-integration/.match(slug)
|
||||
'Deployment'
|
||||
else
|
||||
nav_link = doc.document # document
|
||||
.at_css('aside li.current') # item in navbar
|
||||
|
||||
if nav_link
|
||||
nav_link
|
||||
.parent # <ul> in navbar
|
||||
.previous_element # header before <ul>
|
||||
.content # category
|
||||
else
|
||||
'Miscellaneous'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
34
lib/docs/scrapers/jekyll.rb
Normal file
34
lib/docs/scrapers/jekyll.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
module Docs
|
||||
class Jekyll < UrlScraper
|
||||
self.type = 'jekyll'
|
||||
self.release = '3.6.2'
|
||||
self.base_url = 'https://jekyllrb.com/docs/'
|
||||
self.root_path = 'home/'
|
||||
self.links = {
|
||||
home: 'https://jekyllrb.com/',
|
||||
code: 'https://github.com/jekyll/jekyll'
|
||||
}
|
||||
|
||||
html_filters.push 'jekyll/clean_html', 'jekyll/entries'
|
||||
|
||||
options[:trailing_slash] = true
|
||||
options[:container] = 'article'
|
||||
options[:skip] = [
|
||||
'',
|
||||
'/'
|
||||
]
|
||||
options[:skip_patterns] = [
|
||||
/conduct/,
|
||||
/history/,
|
||||
/maintaining/,
|
||||
/contributing/
|
||||
]
|
||||
options[:attribution] = <<-HTML
|
||||
© 2008–2017 Tom Preston-Werner and Jekyll contributors<br />
|
||||
Licensed under
|
||||
<a href="https://github.com/jekyll/jekyll/blob/master/LICENSE">
|
||||
the MIT license
|
||||
</a>
|
||||
HTML
|
||||
end
|
||||
end
|
BIN
public/icons/docs/jekyll/16.png
Normal file
BIN
public/icons/docs/jekyll/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 357 B |
BIN
public/icons/docs/jekyll/16@2x.png
Normal file
BIN
public/icons/docs/jekyll/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 809 B |
1
public/icons/docs/jekyll/SOURCE
Normal file
1
public/icons/docs/jekyll/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://avatars3.githubusercontent.com/u/3083652
|
Loading…
Reference in a new issue