Skip to content

Commit 15fcdc2

Browse files
switched to the simple styling option
1 parent 58d3d7d commit 15fcdc2

File tree

2 files changed

+6
-66
lines changed

2 files changed

+6
-66
lines changed

lib/docs/filters/threejs/clean_html.rb

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,7 @@ class CleanHtmlFilter < Filter
44
def call
55
# Remove unnecessary elements
66
css('head, script, style').remove
7-
8-
# Add syntax highlighting CSS
9-
style = doc.document.create_element('style')
10-
style.content = <<-CSS
11-
.highlight { background: #272b30; color: #e9ecef; border-radius: 4px; margin: 1em 0; }
12-
.highlight pre { margin: 0; padding: 10px; }
13-
.highlight .k { color: #cc7832; font-weight: bold; } /* Keyword */
14-
.highlight .kd { color: #cc7832; font-weight: bold; } /* Keyword.Declaration */
15-
.highlight .nb { color: #6897bb; } /* Name.Builtin */
16-
.highlight .nx { color: #ffc66d; } /* Name.Other */
17-
.highlight .nf { color: #ffc66d; } /* Name.Function */
18-
.highlight .mi { color: #6897bb; } /* Literal.Number.Integer */
19-
.highlight .s1 { color: #6a8759; } /* Literal.String.Single */
20-
.highlight .s2 { color: #6a8759; } /* Literal.String.Double */
21-
.highlight .c1 { color: #808080; font-style: italic; } /* Comment.Single */
22-
.highlight .lineno { color: #606366; margin-right: 10px; -webkit-user-select: none; user-select: none; }
23-
.highlight-javascript { padding: 0; }
24-
25-
/* Method signatures */
26-
.sig { padding: 5px 10px; }
27-
.sig-name { color: #ffc66d; }
28-
.sig-param { color: #e9ecef; }
29-
.sig-param .sig-type { color: #6897bb; }
30-
.sig-returns { color: #cc7832; }
31-
.sig-returns .sig-type { color: #6897bb; }
32-
.sig-paren { color: #e9ecef; }
33-
.property .pre { color: #cc7832; }
34-
35-
/* Inline code */
36-
code.literal { background: #2b2b2b; padding: 2px 4px; border-radius: 3px; }
37-
code.literal .pre { color: #e9ecef; }
38-
39-
/* Links */
40-
.reference { color: #6897bb; text-decoration: none; }
41-
.reference:hover { text-decoration: underline; }
42-
.reference.external { color: #6a8759; }
43-
44-
/* Notes */
45-
.admonition.note { background: #2b2b2b; padding: 12px 15px; border-left: 4px solid #6897bb; margin: 1em 0; }
46-
.admonition-title { color: #6897bb; font-weight: bold; margin: 0 0 5px 0; }
47-
CSS
48-
doc.at_css('head') ? doc.at_css('head').add_child(style) : doc.add_child(style)
49-
50-
# Create a wrapper div for better styling
51-
if root = at_css('body')
52-
content = root.inner_html
53-
else
54-
content = doc.inner_html
55-
end
56-
57-
# Create Django-like structure
58-
content = <<-HTML
59-
<div class="document">
60-
<div class="documentwrapper">
61-
<div class="bodywrapper">
62-
<div class="body" role="main">
63-
#{content}
64-
</div>
65-
</div>
66-
</div>
67-
</div>
68-
HTML
69-
70-
doc.inner_html = content
71-
7+
728
# Handle source links
739
css('h2').each do |node|
7410
if node.content.strip == 'Source'
@@ -319,6 +255,10 @@ def call
319255
end
320256
end
321257

258+
# Remove the navigation arrows and links
259+
css('.nav').remove if at_css('.nav')
260+
# If the arrows are in a different container, adjust the selector accordingly
261+
322262
doc
323263
end
324264

lib/docs/scrapers/threejs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Docs
22
class Threejs < FileScraper
33
self.name = 'Three.js'
4-
self.type = 'threejs'
4+
self.type = 'simple'
55
self.slug = 'threejs'
66
self.links = {
77
home: 'https://threejs.org/',

0 commit comments

Comments
 (0)