mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
parent
6ad0784fbe
commit
d49eea4640
7 changed files with 59 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
[
|
||||
[
|
||||
"2021-12-07",
|
||||
"New documentation: <a href=\"/prettier/\">Prettier</a>",
|
||||
"Renamed documentation: <a href=\"/dom/\">Web APIs</a>"
|
||||
],
|
||||
[
|
||||
|
|
|
@ -666,6 +666,11 @@ credits = [
|
|||
'1996-2021 The PostgreSQL Global Development Group<br>© 1994 The Regents of the University of California',
|
||||
'PostgreSQL',
|
||||
'https://www.postgresql.org/about/licence/'
|
||||
], [
|
||||
'Prettier',
|
||||
'James Long and contributors',
|
||||
'MIT',
|
||||
'https://raw.githubusercontent.com/prettier/prettier/main/LICENSE '
|
||||
], [
|
||||
'Puppeteer',
|
||||
'2021 Google Inc',
|
||||
|
|
27
lib/docs/filters/prettier/entries.rb
Normal file
27
lib/docs/filters/prettier/entries.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
module Docs
|
||||
class Prettier
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').children.select(&:text?).map(&:content).join.strip
|
||||
end
|
||||
|
||||
def type
|
||||
link = at_css('.navListItemActive')
|
||||
section = link.ancestors('.navGroup').first
|
||||
type = section.at_css('h3').content.strip
|
||||
return name if type == 'Configuring Prettier'
|
||||
return name if type == 'Usage'
|
||||
type
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entries = []
|
||||
css('.mainContainer h2').each do |node|
|
||||
id = node.at_css('.anchor')['id']
|
||||
entries << [node.text, id]
|
||||
end
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
25
lib/docs/scrapers/prettier.rb
Normal file
25
lib/docs/scrapers/prettier.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
module Docs
|
||||
class Prettier < UrlScraper
|
||||
self.name = 'Prettier'
|
||||
self.type = 'simple'
|
||||
self.release = '2.5.1'
|
||||
self.base_url = 'https://prettier.io/docs/en/'
|
||||
self.links = {
|
||||
home: 'https://prettier.io/',
|
||||
code: 'https://github.com/prettier/prettier'
|
||||
}
|
||||
|
||||
# Docusaurus like react_native
|
||||
html_filters.push 'prettier/entries', 'react_native/clean_html'
|
||||
|
||||
options[:container] = '.docMainWrapper'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© James Long and contributors
|
||||
HTML
|
||||
|
||||
def get_latest_version(opts)
|
||||
get_npm_version('prettier', opts)
|
||||
end
|
||||
end
|
||||
end
|
BIN
public/icons/docs/prettier/16.png
Normal file
BIN
public/icons/docs/prettier/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 941 B |
BIN
public/icons/docs/prettier/16@2x.png
Normal file
BIN
public/icons/docs/prettier/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
1
public/icons/docs/prettier/SOURCE
Normal file
1
public/icons/docs/prettier/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://prettier.io/icon.png
|
Loading…
Reference in a new issue