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
4 changes: 4 additions & 0 deletions assets/javascripts/news.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
[
"2026-07-09",
"New documentation: <a href=\"/maplibre_gl/\">MapLibre GL JS</a>"
],
[
"2026-07-08",
"New documentation: <a href=\"/odin/\">Odin</a>"
Expand Down
1 change: 1 addition & 0 deletions assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
@use 'pages/love';
@use 'pages/lua';
@use 'pages/gnu_make';
@use 'pages/maplibre_gl';
@use 'pages/mariadb';
@use 'pages/mdn';
@use 'pages/meteor';
Expand Down
17 changes: 17 additions & 0 deletions assets/stylesheets/pages/_maplibre_gl.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@use 'global/classes';

._maplibre_gl {
> h1 { @extend %block-heading; }
> h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }

code { @extend %label; }

.admonition { @extend %note; }
.admonition.tip { @extend %note-green; }
.admonition.note, .admonition.info { @extend %note-blue; }
.admonition.warning { @extend %note-orange; }
.admonition-title {
font-weight: var(--bolderFontWeight);
}
}
32 changes: 32 additions & 0 deletions lib/docs/filters/maplibre_gl/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Docs
class MaplibreGl
class CleanHtmlFilter < Filter
def call
# Anchor icons next to headings.
css('.headerlink').remove

# The TypeDoc pages carry a "Defined in: <source link>" paragraph on
# every member; it points at a pinned commit and adds noise.
css('p').each do |node|
node.remove if node.content.start_with?('Defined in:')
end

# MkDocs Material renders highlighted code as
# <div class="language-xx highlight"><pre><code>…lots of spans…</code></pre></div>
# with per-line anchors. Flatten each block to its plain text and tag
# the language so DevDocs can re-highlight it.
css('div.highlight').each do |node|
language = node['class'][/language-(\w+)/, 1]
pre = node.at_css('pre')
next unless pre

pre['data-language'] = language if language
pre.content = pre.at_css('code').content
node.replace(pre)
end

doc
end
end
end
end
52 changes: 52 additions & 0 deletions lib/docs/filters/maplibre_gl/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module Docs
class MaplibreGl
class EntriesFilter < Docs::EntriesFilter
# Sections of a TypeDoc class page whose members are worth indexing
# individually.
MEMBER_SECTIONS = %w(Constructors Properties Methods Events Accessors).freeze

def get_name
at_css('h1').content.strip
end

def get_type
# DevDocs lower-cases paths, so match against the lower-cased segments.
case path
when %r{api/classes/} then 'Classes'
when %r{api/functions/} then 'Functions'
when %r{api/type-aliases/} then 'Type Aliases'
when %r{api/interfaces/} then 'Interfaces'
when %r{api/enumerations/} then 'Enumerations'
when %r{api/variables/} then 'Variables'
when %r{\Aguides/} then 'Guides'
else 'Miscellaneous'
end
end

def additional_entries
return [] unless class_page?

entries = []
section = nil

css('h2, h3').each do |node|
if node.name == 'h2'
section = node.content.strip
elsif MEMBER_SECTIONS.include?(section)
member = node.content.strip.sub(/\(\)\z/, '').sub(/\?\z/, '')
next if member.empty?
entries << ["#{get_name}.#{member}", "#{path}##{node['id']}"]
end
end

entries
end

private

def class_page?
path.include?('api/classes/')
end
end
end
end
47 changes: 47 additions & 0 deletions lib/docs/scrapers/maplibre_gl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module Docs
class MaplibreGl < UrlScraper
self.name = 'MapLibre GL JS'
self.slug = 'maplibre_gl'
self.type = 'maplibre_gl'
self.release = '5.24.0'
self.base_url = 'https://maplibre.org/maplibre-gl-js/docs/'
self.root_path = '/'
self.links = {
home: 'https://maplibre.org/maplibre-gl-js/docs/',
code: 'https://github.com/maplibre/maplibre-gl-js'
}

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

options[:container] = '.md-content__inner'

# Only scrape the TypeDoc-generated API reference and the guides.
# The examples (200+ interactive demos) and the embedded style
# specification are excluded as they aren't API reference material.
options[:only_patterns] = [
%r{\AAPI/classes/},
%r{\AAPI/functions/},
%r{\AAPI/type-aliases/},
%r{\AAPI/interfaces/},
%r{\AAPI/enumerations/},
%r{\AAPI/variables/},
%r{\Aguides/}
]

# The site's navigation links point at the `www.` host, which then
# redirects (301) to the bare domain used by `base_url`. Rewrite them so
# they are recognised as internal URLs and get followed.
options[:fix_urls] = ->(url) do
url.sub(%r{\Ahttps://www\.maplibre\.org/}, 'https://maplibre.org/')
end

options[:attribution] = <<-HTML
&copy; MapLibre contributors<br>
Licensed under the 3-Clause BSD License.
HTML

def get_latest_version(opts)
get_npm_version('maplibre-gl', opts)
end
end
end
2 changes: 1 addition & 1 deletion lib/docs/scrapers/mdn/javascript.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Javascript < Mdn
prepend FixInternalUrlsBehavior
prepend FixRedirectionsBehavior

# release = '2026-05-26'
# release = '2026-07-08'
self.name = 'JavaScript'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'
self.links = {
Expand Down
Binary file added public/icons/docs/maplibre_gl/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/maplibre_gl/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.
1 change: 1 addition & 0 deletions public/icons/docs/maplibre_gl/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SOURCE: https://raw.githubusercontent.com/maplibre/maplibre-gl-js/main/docs/assets/logo.svg
Loading