History

Add Prettier documentation (2.5.1)

https://prettier.io/

Simon Legner committed 4 years ago

Commit d49eea41 parent 6ad07847 files · +57 −-2Browse files

Unified · Split

7 files
  1. assets/javascripts/news.json +1 −0
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. lib/docs/filters/prettier/entries.rb +27 −0
  4. lib/docs/scrapers/prettier.rb +25 −0
  5. public/icons/docs/prettier/16.png +0 −0
  6. public/icons/docs/prettier/16@2x.png +0 −0
  7. public/icons/docs/prettier/SOURCE +1 −0
assets/javascripts/news.json+1−0
@@ -1,6 +1,7 @@
11 [
22 [
33 "2021-12-07",
4+ "New documentation: <a href=\"/prettier/\">Prettier</a>",
45 "Renamed documentation: <a href=\"/dom/\">Web APIs</a>"
56 ],
67 [
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -666,6 +666,11 @@ credits = [ · 665 unmodified lines
666666 '1996-2021 The PostgreSQL Global Development Group<br>&copy; 1994 The Regents of the University of California',
667667 'PostgreSQL',
668668 'https://www.postgresql.org/about/licence/'
669+ ], [
670+ 'Prettier',
671+ 'James Long and contributors',
672+ 'MIT',
673+ 'https://raw.githubusercontent.com/prettier/prettier/main/LICENSE '
669674 ], [
670675 'Puppeteer',
671676 '2021 Google Inc',
lib/docs/filters/prettier/entries.rb+27−0
@@ -0,0 +1,27 @@
1+module Docs
2+ class Prettier
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ at_css('h1').children.select(&:text?).map(&:content).join.strip
6+ end
7+
8+ def type
9+ link = at_css('.navListItemActive')
10+ section = link.ancestors('.navGroup').first
11+ type = section.at_css('h3').content.strip
12+ return name if type == 'Configuring Prettier'
13+ return name if type == 'Usage'
14+ type
15+ end
16+
17+ def additional_entries
18+ entries = []
19+ css('.mainContainer h2').each do |node|
20+ id = node.at_css('.anchor')['id']
21+ entries << [node.text, id]
22+ end
23+ entries
24+ end
25+ end
26+ end
27+end
lib/docs/scrapers/prettier.rb+25−0
@@ -0,0 +1,25 @@
1+module Docs
2+ class Prettier < UrlScraper
3+ self.name = 'Prettier'
4+ self.type = 'simple'
5+ self.release = '2.5.1'
6+ self.base_url = 'https://prettier.io/docs/en/'
7+ self.links = {
8+ home: 'https://prettier.io/',
9+ code: 'https://github.com/prettier/prettier'
10+ }
11+
12+ # Docusaurus like react_native
13+ html_filters.push 'prettier/entries', 'react_native/clean_html'
14+
15+ options[:container] = '.docMainWrapper'
16+
17+ options[:attribution] = <<-HTML
18+ &copy; James Long and contributors
19+ HTML
20+
21+ def get_latest_version(opts)
22+ get_npm_version('prettier', opts)
23+ end
24+ end
25+end
public/icons/docs/prettier/16.png+0−0

Binary file not shown.

public/icons/docs/prettier/16@2x.png+0−0

Binary file not shown.

public/icons/docs/prettier/SOURCE+1−0
@@ -0,0 +1 @@
1+https://prettier.io/icon.png