Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/javascripts/news.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"2025-10-19",
"New documentations: <a href=\"/lit/\">Lit</a>, <a href=\"/graphviz/\">Graphviz</a>"
"New documentations: <a href=\"/lit/\">Lit</a>, <a href=\"/graphviz/\">Graphviz</a>, <a href=\"/bun/\">Bun</a>"
],
[
"2025-07-14",
Expand Down
43 changes: 43 additions & 0 deletions lib/docs/filters/bun/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module Docs
class Bun
class CleanHtmlFilter < Filter
def call
@doc = at_css('section > .w-full')

header = at_css('header:has(h1)')
if header
header.content = header.at_css('h1').content
header.name = 'h1'
end

css('.CodeBlockTab').remove
css('.CopyIcon').remove
css('svg').remove
css('a:contains("Edit on GitHub")').remove
css('a:contains("Previous")').remove
css('a:contains("Next")').remove

css('pre').each do |node|
node.content = node.content
node['data-language'] = 'typescript'
node.remove_attribute('style')
end

css('.font-mono').each do |node|
node.name = 'code'
end

css('.font-mono.text-blue-600').each do |node|
node[:class] = 'token keyword'
end

css('*[class]').each do |node|
next if node.name == 'code'
node.remove_attribute('class')
end

doc
end
end
end
end
30 changes: 30 additions & 0 deletions lib/docs/filters/bun/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module Docs
class Bun
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1') ? at_css('h1').content : at_css('h2').content
name
end

def get_type
slug.split('/').first
end

def additional_entries
if slug.start_with?('cli')
css('h2[id]').each_with_object [] do |node, entries|
name = get_name + " " + node.content.strip
entries << [name, node['id']]
end
elsif slug.start_with?('api')
css('h2[id]').each_with_object [] do |node, entries|
name = get_name + ": " + node.content.strip
entries << [name, node['id']]
end
else
[]
end
end
end
end
end
1 change: 1 addition & 0 deletions lib/docs/filters/core/images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def call

self.class.cache[src] = false

next if src.start_with? 'data:image/'
url = Docs::URL.parse(src)
url.scheme = 'https' if url.scheme.nil?
next unless url.scheme == 'http' || url.scheme == 'https'
Expand Down
32 changes: 32 additions & 0 deletions lib/docs/scrapers/bun.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Docs
class Bun < UrlScraper
self.name = 'Bun'
self.type = 'simple'
self.slug = 'bun'
self.links = {
home: 'https://leafletjs.com/',
code: 'https://github.com/oven-sh/bun'
}
self.release = '1.3.0'
self.base_url = "https://bun.com/docs/"
self.root_path = 'installation'

html_filters.push 'bun/clean_html', 'bun/entries'

# https://bun.com/docs/project/licensing
options[:attribution] = <<-HTML
&copy; bun.com, oven-sh, Jarred Sumner<br>
Licensed under the MIT License.
HTML

options[:skip_patterns] = [/^project/]
options[:fix_urls] = ->(url) do
url.sub! %r{.md$}, ''
url
end

def get_latest_version(opts)
tags = get_github_tags('oven-sh', 'bun', opts)
end
end
end
Binary file added public/icons/docs/bun/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/docs/bun/16@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions public/icons/docs/bun/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://bun.com/icons/favicon-16x16.png
https://bun.com/icons/favicon-32x32.png