docyard 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/CHANGELOG.md +34 -1
- data/lib/docyard/build/asset_bundler.rb +22 -7
- data/lib/docyard/build/file_copier.rb +49 -27
- data/lib/docyard/build/sitemap_generator.rb +6 -6
- data/lib/docyard/build/static_generator.rb +82 -50
- data/lib/docyard/builder.rb +20 -10
- data/lib/docyard/cli.rb +6 -3
- data/lib/docyard/components/aliases.rb +29 -0
- data/lib/docyard/components/processors/callout_processor.rb +124 -0
- data/lib/docyard/components/processors/code_block_diff_preprocessor.rb +106 -0
- data/lib/docyard/components/processors/code_block_focus_preprocessor.rb +79 -0
- data/lib/docyard/components/processors/code_block_options_preprocessor.rb +78 -0
- data/lib/docyard/components/processors/code_block_processor.rb +175 -0
- data/lib/docyard/components/processors/code_snippet_import_preprocessor.rb +127 -0
- data/lib/docyard/components/processors/heading_anchor_processor.rb +39 -0
- data/lib/docyard/components/processors/icon_processor.rb +53 -0
- data/lib/docyard/components/processors/table_of_contents_processor.rb +68 -0
- data/lib/docyard/components/processors/table_wrapper_processor.rb +22 -0
- data/lib/docyard/components/processors/tabs_processor.rb +48 -0
- data/lib/docyard/components/support/code_block/feature_extractor.rb +117 -0
- data/lib/docyard/components/support/code_block/icon_detector.rb +44 -0
- data/lib/docyard/components/support/code_block/line_parser.rb +84 -0
- data/lib/docyard/components/support/code_block/line_wrapper.rb +50 -0
- data/lib/docyard/components/support/code_block/patterns.rb +55 -0
- data/lib/docyard/components/support/code_detector.rb +61 -0
- data/lib/docyard/components/support/tabs/icon_detector.rb +62 -0
- data/lib/docyard/components/support/tabs/parser.rb +195 -0
- data/lib/docyard/components/support/tabs/range_finder.rb +46 -0
- data/lib/docyard/config/branding_resolver.rb +183 -0
- data/lib/docyard/{constants.rb → config/constants.rb} +7 -4
- data/lib/docyard/config/validator.rb +122 -99
- data/lib/docyard/config.rb +38 -36
- data/lib/docyard/initializer.rb +15 -76
- data/lib/docyard/navigation/breadcrumb_builder.rb +133 -0
- data/lib/docyard/{prev_next_builder.rb → navigation/prev_next_builder.rb} +6 -3
- data/lib/docyard/navigation/sidebar/children_discoverer.rb +51 -0
- data/lib/docyard/navigation/sidebar/config_parser.rb +208 -0
- data/lib/docyard/navigation/sidebar/file_resolver.rb +78 -0
- data/lib/docyard/{sidebar → navigation/sidebar}/file_system_scanner.rb +2 -1
- data/lib/docyard/navigation/sidebar/item.rb +96 -0
- data/lib/docyard/navigation/sidebar/local_config_loader.rb +51 -0
- data/lib/docyard/navigation/sidebar/metadata_extractor.rb +69 -0
- data/lib/docyard/navigation/sidebar/metadata_reader.rb +47 -0
- data/lib/docyard/navigation/sidebar/path_prefixer.rb +34 -0
- data/lib/docyard/navigation/sidebar/renderer.rb +144 -0
- data/lib/docyard/navigation/sidebar/sorter.rb +21 -0
- data/lib/docyard/navigation/sidebar/tree_builder.rb +139 -0
- data/lib/docyard/navigation/sidebar/tree_filter.rb +55 -0
- data/lib/docyard/navigation/sidebar_builder.rb +159 -0
- data/lib/docyard/rendering/icon_helpers.rb +13 -0
- data/lib/docyard/{icons → rendering/icons}/phosphor.rb +26 -1
- data/lib/docyard/{markdown.rb → rendering/markdown.rb} +19 -13
- data/lib/docyard/rendering/renderer.rb +163 -0
- data/lib/docyard/rendering/template_resolver.rb +172 -0
- data/lib/docyard/routing/fallback_resolver.rb +92 -0
- data/lib/docyard/search/build_indexer.rb +74 -0
- data/lib/docyard/search/dev_indexer.rb +155 -0
- data/lib/docyard/search/pagefind_support.rb +33 -0
- data/lib/docyard/{asset_handler.rb → server/asset_handler.rb} +24 -19
- data/lib/docyard/{server.rb → server/dev_server.rb} +32 -9
- data/lib/docyard/server/pagefind_handler.rb +63 -0
- data/lib/docyard/{preview_server.rb → server/preview_server.rb} +2 -2
- data/lib/docyard/server/rack_application.rb +192 -0
- data/lib/docyard/server/resolution_result.rb +29 -0
- data/lib/docyard/{router.rb → server/router.rb} +4 -4
- data/lib/docyard/templates/assets/css/code.css +18 -51
- data/lib/docyard/templates/assets/css/components/breadcrumbs.css +143 -0
- data/lib/docyard/templates/assets/css/components/callout.css +67 -67
- data/lib/docyard/templates/assets/css/components/code-block.css +180 -282
- data/lib/docyard/templates/assets/css/components/heading-anchor.css +28 -15
- data/lib/docyard/templates/assets/css/components/icon.css +0 -1
- data/lib/docyard/templates/assets/css/components/logo.css +0 -2
- data/lib/docyard/templates/assets/css/components/nav-menu.css +237 -0
- data/lib/docyard/templates/assets/css/components/navigation.css +186 -167
- data/lib/docyard/templates/assets/css/components/prev-next.css +76 -47
- data/lib/docyard/templates/assets/css/components/search.css +561 -0
- data/lib/docyard/templates/assets/css/components/tab-bar.css +163 -0
- data/lib/docyard/templates/assets/css/components/table-of-contents.css +127 -114
- data/lib/docyard/templates/assets/css/components/tabs.css +119 -160
- data/lib/docyard/templates/assets/css/components/theme-toggle.css +48 -44
- data/lib/docyard/templates/assets/css/landing.css +815 -0
- data/lib/docyard/templates/assets/css/layout.css +503 -87
- data/lib/docyard/templates/assets/css/main.css +1 -3
- data/lib/docyard/templates/assets/css/markdown.css +111 -93
- data/lib/docyard/templates/assets/css/reset.css +0 -3
- data/lib/docyard/templates/assets/css/typography.css +43 -41
- data/lib/docyard/templates/assets/css/variables.css +268 -208
- data/lib/docyard/templates/assets/favicon.svg +7 -8
- data/lib/docyard/templates/assets/fonts/Inter-Variable.ttf +0 -0
- data/lib/docyard/templates/assets/js/components/code-block.js +24 -42
- data/lib/docyard/templates/assets/js/components/heading-anchor.js +26 -24
- data/lib/docyard/templates/assets/js/components/navigation.js +181 -70
- data/lib/docyard/templates/assets/js/components/search.js +610 -0
- data/lib/docyard/templates/assets/js/components/sidebar-toggle.js +29 -0
- data/lib/docyard/templates/assets/js/components/tab-navigation.js +145 -0
- data/lib/docyard/templates/assets/js/components/table-of-contents.js +153 -66
- data/lib/docyard/templates/assets/js/components/tabs.js +31 -69
- data/lib/docyard/templates/assets/js/theme.js +0 -3
- data/lib/docyard/templates/assets/logo-dark.svg +8 -2
- data/lib/docyard/templates/assets/logo.svg +7 -4
- data/lib/docyard/templates/config/docyard.yml.erb +37 -34
- data/lib/docyard/templates/errors/404.html.erb +1 -1
- data/lib/docyard/templates/errors/500.html.erb +1 -1
- data/lib/docyard/templates/layouts/default.html.erb +19 -56
- data/lib/docyard/templates/layouts/splash.html.erb +176 -0
- data/lib/docyard/templates/partials/_breadcrumbs.html.erb +24 -0
- data/lib/docyard/templates/partials/_code_block.html.erb +6 -4
- data/lib/docyard/templates/partials/_doc_footer.html.erb +25 -0
- data/lib/docyard/templates/partials/_features.html.erb +15 -0
- data/lib/docyard/templates/partials/_footer.html.erb +42 -0
- data/lib/docyard/templates/partials/_head.html.erb +22 -0
- data/lib/docyard/templates/partials/_header.html.erb +49 -0
- data/lib/docyard/templates/partials/_heading_anchor.html.erb +3 -1
- data/lib/docyard/templates/partials/_hero.html.erb +27 -0
- data/lib/docyard/templates/partials/_nav_group.html.erb +25 -11
- data/lib/docyard/templates/partials/_nav_leaf.html.erb +1 -1
- data/lib/docyard/templates/partials/_nav_menu.html.erb +42 -0
- data/lib/docyard/templates/partials/_nav_nested_section.html.erb +11 -0
- data/lib/docyard/templates/partials/_nav_section.html.erb +1 -1
- data/lib/docyard/templates/partials/_prev_next.html.erb +9 -3
- data/lib/docyard/templates/partials/_scripts.html.erb +7 -0
- data/lib/docyard/templates/partials/_search_modal.html.erb +41 -0
- data/lib/docyard/templates/partials/_search_trigger.html.erb +18 -0
- data/lib/docyard/templates/partials/_sidebar.html.erb +21 -4
- data/lib/docyard/templates/partials/_tab_bar.html.erb +25 -0
- data/lib/docyard/templates/partials/_table_of_contents.html.erb +12 -12
- data/lib/docyard/templates/partials/_table_of_contents_toggle.html.erb +1 -3
- data/lib/docyard/templates/partials/_tabs.html.erb +2 -2
- data/lib/docyard/templates/partials/_theme_toggle.html.erb +2 -11
- data/lib/docyard/utils/html_helpers.rb +14 -0
- data/lib/docyard/utils/path_resolver.rb +2 -1
- data/lib/docyard/utils/url_helpers.rb +20 -0
- data/lib/docyard/version.rb +1 -1
- data/lib/docyard.rb +22 -15
- metadata +89 -50
- data/lib/docyard/components/callout_processor.rb +0 -121
- data/lib/docyard/components/code_block_diff_preprocessor.rb +0 -104
- data/lib/docyard/components/code_block_feature_extractor.rb +0 -113
- data/lib/docyard/components/code_block_focus_preprocessor.rb +0 -77
- data/lib/docyard/components/code_block_icon_detector.rb +0 -40
- data/lib/docyard/components/code_block_line_wrapper.rb +0 -46
- data/lib/docyard/components/code_block_options_preprocessor.rb +0 -76
- data/lib/docyard/components/code_block_patterns.rb +0 -51
- data/lib/docyard/components/code_block_processor.rb +0 -176
- data/lib/docyard/components/code_detector.rb +0 -59
- data/lib/docyard/components/code_line_parser.rb +0 -80
- data/lib/docyard/components/code_snippet_import_preprocessor.rb +0 -125
- data/lib/docyard/components/heading_anchor_processor.rb +0 -34
- data/lib/docyard/components/icon_detector.rb +0 -57
- data/lib/docyard/components/icon_processor.rb +0 -51
- data/lib/docyard/components/table_of_contents_processor.rb +0 -64
- data/lib/docyard/components/table_wrapper_processor.rb +0 -18
- data/lib/docyard/components/tabs_parser.rb +0 -191
- data/lib/docyard/components/tabs_processor.rb +0 -44
- data/lib/docyard/components/tabs_range_finder.rb +0 -42
- data/lib/docyard/rack_application.rb +0 -172
- data/lib/docyard/renderer.rb +0 -120
- data/lib/docyard/routing/resolution_result.rb +0 -31
- data/lib/docyard/sidebar/config_parser.rb +0 -180
- data/lib/docyard/sidebar/item.rb +0 -58
- data/lib/docyard/sidebar/renderer.rb +0 -137
- data/lib/docyard/sidebar/tree_builder.rb +0 -59
- data/lib/docyard/sidebar_builder.rb +0 -102
- data/lib/docyard/templates/markdown/getting-started/installation.md.erb +0 -77
- data/lib/docyard/templates/markdown/guides/configuration.md.erb +0 -202
- data/lib/docyard/templates/markdown/guides/markdown-features.md.erb +0 -247
- data/lib/docyard/templates/markdown/index.md.erb +0 -82
- /data/lib/docyard/{sidebar → navigation/sidebar}/title_extractor.rb +0 -0
- /data/lib/docyard/{icons → rendering/icons}/LICENSE.phosphor +0 -0
- /data/lib/docyard/{icons → rendering/icons}/file_types.rb +0 -0
- /data/lib/docyard/{icons.rb → rendering/icons.rb} +0 -0
- /data/lib/docyard/{language_mapping.rb → rendering/language_mapping.rb} +0 -0
- /data/lib/docyard/{file_watcher.rb → server/file_watcher.rb} +0 -0
- /data/lib/docyard/{errors.rb → utils/errors.rb} +0 -0
- /data/lib/docyard/{logging.rb → utils/logging.rb} +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "erb"
|
|
4
|
-
|
|
5
|
-
module Docyard
|
|
6
|
-
module Sidebar
|
|
7
|
-
class Renderer
|
|
8
|
-
PARTIALS_PATH = File.join(__dir__, "../templates/partials")
|
|
9
|
-
|
|
10
|
-
attr_reader :site_title, :base_url
|
|
11
|
-
|
|
12
|
-
def initialize(site_title: "Documentation", base_url: "/")
|
|
13
|
-
@site_title = site_title
|
|
14
|
-
@base_url = normalize_base_url(base_url)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def render(tree)
|
|
18
|
-
return "" if tree.empty?
|
|
19
|
-
|
|
20
|
-
nav_content = render_tree_with_sections(tree)
|
|
21
|
-
footer_html = render_partial(:sidebar_footer)
|
|
22
|
-
|
|
23
|
-
render_partial(:sidebar, nav_content: nav_content, footer_html: footer_html)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
def render_partial(name, locals = {})
|
|
29
|
-
template_path = File.join(PARTIALS_PATH, "_#{name}.html.erb")
|
|
30
|
-
template = File.read(template_path)
|
|
31
|
-
|
|
32
|
-
locals.each { |key, value| instance_variable_set("@#{key}", value) }
|
|
33
|
-
|
|
34
|
-
erb_binding = binding
|
|
35
|
-
ERB.new(template).result(erb_binding)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def icon(name, weight = "regular")
|
|
39
|
-
Icons.render(name.to_s.tr("_", "-"), weight) || ""
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def link_path(path)
|
|
43
|
-
return path if path.nil? || path.start_with?("http://", "https://")
|
|
44
|
-
|
|
45
|
-
"#{base_url.chomp('/')}#{path}"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def normalize_base_url(url)
|
|
49
|
-
return "/" if url.nil? || url.empty?
|
|
50
|
-
|
|
51
|
-
url = "/#{url}" unless url.start_with?("/")
|
|
52
|
-
url.end_with?("/") ? url : "#{url}/"
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def render_tree_with_sections(items)
|
|
56
|
-
filtered_items = items.reject { |item| item[:title]&.downcase == site_title.downcase }
|
|
57
|
-
grouped_items = group_by_section(filtered_items)
|
|
58
|
-
|
|
59
|
-
grouped_items.map do |section_name, section_items|
|
|
60
|
-
render_section(section_name, section_items)
|
|
61
|
-
end.join
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def render_section(section_name, section_items)
|
|
65
|
-
section_content = render_tree(section_items)
|
|
66
|
-
render_partial(:nav_section, section_name: section_name, section_content: section_content)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def group_by_section(items)
|
|
70
|
-
sections = {}
|
|
71
|
-
root_items = []
|
|
72
|
-
|
|
73
|
-
items.each do |item|
|
|
74
|
-
process_section_item(item, sections, root_items)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
build_section_result(sections, root_items)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def process_section_item(item, sections, root_items)
|
|
81
|
-
return if item[:title]&.downcase == site_title.downcase
|
|
82
|
-
|
|
83
|
-
if item[:type] == :directory && !item[:children].empty?
|
|
84
|
-
section_name = item[:title].upcase
|
|
85
|
-
sections[section_name] = item[:children]
|
|
86
|
-
else
|
|
87
|
-
root_items << item
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def build_section_result(sections, root_items)
|
|
92
|
-
result = {}
|
|
93
|
-
result[nil] = root_items unless root_items.empty?
|
|
94
|
-
result.merge!(sections)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def render_tree(items)
|
|
98
|
-
return "" if items.empty?
|
|
99
|
-
|
|
100
|
-
list_items = items.map { |item| render_item(item) }.join
|
|
101
|
-
render_partial(:nav_list, list_items: list_items)
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def render_item(item)
|
|
105
|
-
item_content = if item[:children].empty?
|
|
106
|
-
render_leaf_item(item)
|
|
107
|
-
else
|
|
108
|
-
render_group_item(item)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
render_partial(:nav_item, item_content: item_content)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def render_leaf_item(item)
|
|
115
|
-
render_partial(
|
|
116
|
-
:nav_leaf,
|
|
117
|
-
path: item[:path],
|
|
118
|
-
title: item[:title],
|
|
119
|
-
active: item[:active],
|
|
120
|
-
icon: item[:icon],
|
|
121
|
-
target: item[:target]
|
|
122
|
-
)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def render_group_item(item)
|
|
126
|
-
children_html = render_tree(item[:children])
|
|
127
|
-
render_partial(
|
|
128
|
-
:nav_group,
|
|
129
|
-
title: item[:title],
|
|
130
|
-
children_html: children_html,
|
|
131
|
-
icon: item[:icon],
|
|
132
|
-
collapsed: item[:collapsed]
|
|
133
|
-
)
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Docyard
|
|
4
|
-
module Sidebar
|
|
5
|
-
class TreeBuilder
|
|
6
|
-
attr_reader :docs_path, :current_path, :title_extractor
|
|
7
|
-
|
|
8
|
-
def initialize(docs_path:, current_path:, title_extractor: TitleExtractor.new)
|
|
9
|
-
@docs_path = docs_path
|
|
10
|
-
@current_path = Utils::PathResolver.normalize(current_path)
|
|
11
|
-
@title_extractor = title_extractor
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def build(file_items)
|
|
15
|
-
transform_items(file_items, "")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
def transform_items(items, relative_base)
|
|
21
|
-
items.map do |item|
|
|
22
|
-
if item[:type] == :directory
|
|
23
|
-
transform_directory(item, relative_base)
|
|
24
|
-
else
|
|
25
|
-
transform_file(item, relative_base)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def transform_directory(item, relative_base)
|
|
31
|
-
dir_path = File.join(relative_base, item[:name])
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
title: Utils::TextFormatter.titleize(item[:name]),
|
|
35
|
-
path: nil,
|
|
36
|
-
active: false,
|
|
37
|
-
type: :directory,
|
|
38
|
-
collapsible: true,
|
|
39
|
-
collapsed: false,
|
|
40
|
-
children: transform_items(item[:children], dir_path)
|
|
41
|
-
}
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def transform_file(item, relative_base)
|
|
45
|
-
file_path = File.join(relative_base, "#{item[:name]}#{Constants::MARKDOWN_EXTENSION}")
|
|
46
|
-
full_file_path = File.join(docs_path, file_path)
|
|
47
|
-
url_path = Utils::PathResolver.to_url(file_path.delete_suffix(Constants::MARKDOWN_EXTENSION))
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
title: title_extractor.extract(full_file_path),
|
|
51
|
-
path: url_path,
|
|
52
|
-
active: current_path == url_path,
|
|
53
|
-
type: :file,
|
|
54
|
-
children: []
|
|
55
|
-
}
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "sidebar/file_system_scanner"
|
|
4
|
-
require_relative "sidebar/title_extractor"
|
|
5
|
-
require_relative "sidebar/tree_builder"
|
|
6
|
-
require_relative "sidebar/renderer"
|
|
7
|
-
require_relative "sidebar/config_parser"
|
|
8
|
-
|
|
9
|
-
module Docyard
|
|
10
|
-
class SidebarBuilder
|
|
11
|
-
attr_reader :docs_path, :current_path, :config
|
|
12
|
-
|
|
13
|
-
def initialize(docs_path:, current_path: "/", config: nil)
|
|
14
|
-
@docs_path = docs_path
|
|
15
|
-
@current_path = current_path
|
|
16
|
-
@config = config
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def tree
|
|
20
|
-
@tree ||= build_tree
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def to_html
|
|
24
|
-
renderer.render(tree)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
def build_tree
|
|
30
|
-
if config_sidebar_items?
|
|
31
|
-
build_tree_from_config
|
|
32
|
-
else
|
|
33
|
-
build_tree_from_filesystem
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def build_tree_from_config
|
|
38
|
-
config_parser.parse.map(&:to_h)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def build_tree_from_filesystem
|
|
42
|
-
file_items = scanner.scan
|
|
43
|
-
tree_builder.build(file_items)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def config_sidebar_items?
|
|
47
|
-
config_sidebar_items&.any?
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def config_sidebar_items
|
|
51
|
-
return [] unless config
|
|
52
|
-
|
|
53
|
-
if config.is_a?(Hash)
|
|
54
|
-
config.dig("sidebar", "items") || config.dig(:sidebar, :items) || []
|
|
55
|
-
else
|
|
56
|
-
config.sidebar&.items || []
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def config_parser
|
|
61
|
-
@config_parser ||= Sidebar::ConfigParser.new(
|
|
62
|
-
config_sidebar_items,
|
|
63
|
-
docs_path: docs_path,
|
|
64
|
-
current_path: current_path
|
|
65
|
-
)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def scanner
|
|
69
|
-
@scanner ||= Sidebar::FileSystemScanner.new(docs_path)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def tree_builder
|
|
73
|
-
@tree_builder ||= Sidebar::TreeBuilder.new(
|
|
74
|
-
docs_path: docs_path,
|
|
75
|
-
current_path: current_path
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def renderer
|
|
80
|
-
@renderer ||= Sidebar::Renderer.new(
|
|
81
|
-
site_title: extract_site_title,
|
|
82
|
-
base_url: extract_base_url
|
|
83
|
-
)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def extract_base_url
|
|
87
|
-
if config.is_a?(Hash)
|
|
88
|
-
config.dig(:build, :base_url) || "/"
|
|
89
|
-
else
|
|
90
|
-
config&.build&.base_url || "/"
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def extract_site_title
|
|
95
|
-
if config.is_a?(Hash)
|
|
96
|
-
config[:site_title] || "Documentation"
|
|
97
|
-
else
|
|
98
|
-
config&.site&.title || "Documentation"
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# Installation
|
|
2
|
-
|
|
3
|
-
Get your documentation site up and running in minutes.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
::: note Requirements
|
|
8
|
-
- Ruby 3.0 or higher
|
|
9
|
-
- Bundler (optional, for Gemfile-based projects)
|
|
10
|
-
:::
|
|
11
|
-
|
|
12
|
-
Check your Ruby version:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
ruby --version
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Install Docyard
|
|
19
|
-
|
|
20
|
-
:::tabs
|
|
21
|
-
== Gem Install
|
|
22
|
-
```bash
|
|
23
|
-
gem install docyard
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
== Bundler
|
|
27
|
-
Add to your `Gemfile`:
|
|
28
|
-
|
|
29
|
-
```ruby
|
|
30
|
-
gem 'docyard'
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Then install:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
bundle install
|
|
37
|
-
```
|
|
38
|
-
:::
|
|
39
|
-
|
|
40
|
-
## Verify Installation
|
|
41
|
-
|
|
42
|
-
Check that Docyard was installed successfully:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
docyard version
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Quick Start
|
|
49
|
-
|
|
50
|
-
Initialize a new documentation project:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# Create new project
|
|
54
|
-
docyard init
|
|
55
|
-
|
|
56
|
-
# Start development server
|
|
57
|
-
docyard serve
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Visit [http://localhost:4200](http://localhost:4200) to see your documentation.
|
|
61
|
-
|
|
62
|
-
## Available Commands
|
|
63
|
-
|
|
64
|
-
| Command | Description |
|
|
65
|
-
|---------|-------------|
|
|
66
|
-
| `docyard init` | Initialize a new documentation project |
|
|
67
|
-
| `docyard serve` | Start development server with hot reload |
|
|
68
|
-
| `docyard build` | Build static site for production |
|
|
69
|
-
| `docyard preview` | Preview production build locally |
|
|
70
|
-
|
|
71
|
-
## Next Steps
|
|
72
|
-
|
|
73
|
-
::: tip What's Next?
|
|
74
|
-
- Explore [Markdown Features](../guides/markdown-features) to see what you can do
|
|
75
|
-
- Learn about [Configuration](../guides/configuration) options
|
|
76
|
-
- Start writing your documentation!
|
|
77
|
-
:::
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# Configuration
|
|
2
|
-
|
|
3
|
-
Customize your documentation site with `docyard.yml`.
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
Docyard works without any configuration, but you can customize it by creating a `docyard.yml` file in your project root.
|
|
8
|
-
|
|
9
|
-
::: tip
|
|
10
|
-
The `docyard init` command creates a `docyard.yml` file with helpful examples.
|
|
11
|
-
:::
|
|
12
|
-
|
|
13
|
-
## Basic Configuration
|
|
14
|
-
|
|
15
|
-
```yaml
|
|
16
|
-
site:
|
|
17
|
-
title: "My Documentation"
|
|
18
|
-
description: "Documentation for my project"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Branding
|
|
22
|
-
|
|
23
|
-
### Custom Logo
|
|
24
|
-
|
|
25
|
-
Add your own logo:
|
|
26
|
-
|
|
27
|
-
```yaml
|
|
28
|
-
branding:
|
|
29
|
-
logo: "assets/logo.svg" # Light mode logo
|
|
30
|
-
logo_dark: "assets/logo-dark.svg" # Dark mode logo (optional)
|
|
31
|
-
favicon: "assets/favicon.svg" # Browser tab icon
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
::: note File Paths
|
|
35
|
-
- Paths are relative to the `docs/` directory
|
|
36
|
-
- Or use full URLs: `https://cdn.example.com/logo.svg`
|
|
37
|
-
- Supported formats: SVG, PNG, JPG
|
|
38
|
-
:::
|
|
39
|
-
|
|
40
|
-
### Logo Visibility
|
|
41
|
-
|
|
42
|
-
Control what appears in the header:
|
|
43
|
-
|
|
44
|
-
```yaml
|
|
45
|
-
branding:
|
|
46
|
-
appearance:
|
|
47
|
-
logo: true # Show/hide logo
|
|
48
|
-
title: true # Show/hide site title
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Sidebar Navigation
|
|
52
|
-
|
|
53
|
-
Customize the sidebar structure and order:
|
|
54
|
-
|
|
55
|
-
```yaml
|
|
56
|
-
sidebar:
|
|
57
|
-
items:
|
|
58
|
-
# Simple page reference
|
|
59
|
-
- installation
|
|
60
|
-
|
|
61
|
-
# Page with custom text
|
|
62
|
-
- quick-start:
|
|
63
|
-
text: "Quick Start Guide"
|
|
64
|
-
|
|
65
|
-
# Page with icon
|
|
66
|
-
- configuration:
|
|
67
|
-
text: "Configuration"
|
|
68
|
-
icon: "gear"
|
|
69
|
-
|
|
70
|
-
# Nested group
|
|
71
|
-
- guides:
|
|
72
|
-
text: "User Guides"
|
|
73
|
-
icon: "book-open"
|
|
74
|
-
items:
|
|
75
|
-
- markdown-features
|
|
76
|
-
- customization
|
|
77
|
-
|
|
78
|
-
# External link
|
|
79
|
-
- text: "GitHub"
|
|
80
|
-
link: "https://github.com/yourusername/yourproject"
|
|
81
|
-
icon: "github-logo"
|
|
82
|
-
target: "_blank"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
::: tip Icons
|
|
86
|
-
Browse available icons at [phosphoricons.com](https://phosphoricons.com). Just use the icon name (e.g., `rocket-launch`, `book-open`).
|
|
87
|
-
:::
|
|
88
|
-
|
|
89
|
-
### Collapsible Groups
|
|
90
|
-
|
|
91
|
-
Control whether groups start expanded or collapsed:
|
|
92
|
-
|
|
93
|
-
```yaml
|
|
94
|
-
sidebar:
|
|
95
|
-
items:
|
|
96
|
-
- api:
|
|
97
|
-
text: "API Reference"
|
|
98
|
-
collapsed: true # Start collapsed
|
|
99
|
-
items:
|
|
100
|
-
- authentication
|
|
101
|
-
- endpoints
|
|
102
|
-
- errors
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Build Configuration
|
|
106
|
-
|
|
107
|
-
Configure the build output:
|
|
108
|
-
|
|
109
|
-
```yaml
|
|
110
|
-
build:
|
|
111
|
-
output_dir: "dist" # Output directory for built site
|
|
112
|
-
base_url: "/" # Base URL for deployment
|
|
113
|
-
clean: true # Clean output directory before building
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Base URL
|
|
117
|
-
|
|
118
|
-
Set the base URL for subdirectory deployments:
|
|
119
|
-
|
|
120
|
-
```yaml
|
|
121
|
-
build:
|
|
122
|
-
base_url: "/docs/" # For example.com/docs/
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
::: warning Base URL
|
|
126
|
-
If deploying to a subdirectory, make sure base_url matches your deployment path. Otherwise assets won't load correctly.
|
|
127
|
-
:::
|
|
128
|
-
|
|
129
|
-
## Complete Example
|
|
130
|
-
|
|
131
|
-
Here's a full configuration file:
|
|
132
|
-
|
|
133
|
-
```yaml
|
|
134
|
-
site:
|
|
135
|
-
title: "Acme API Documentation"
|
|
136
|
-
description: "Official API documentation for Acme"
|
|
137
|
-
|
|
138
|
-
branding:
|
|
139
|
-
logo: "assets/logo.svg"
|
|
140
|
-
logo_dark: "assets/logo-dark.svg"
|
|
141
|
-
favicon: "assets/favicon.svg"
|
|
142
|
-
appearance:
|
|
143
|
-
logo: true
|
|
144
|
-
title: true
|
|
145
|
-
|
|
146
|
-
sidebar:
|
|
147
|
-
items:
|
|
148
|
-
- index
|
|
149
|
-
|
|
150
|
-
- getting-started:
|
|
151
|
-
text: "Getting Started"
|
|
152
|
-
icon: "rocket-launch"
|
|
153
|
-
items:
|
|
154
|
-
- installation
|
|
155
|
-
- authentication
|
|
156
|
-
- quick-start
|
|
157
|
-
|
|
158
|
-
- guides:
|
|
159
|
-
text: "Guides"
|
|
160
|
-
icon: "book-open"
|
|
161
|
-
items:
|
|
162
|
-
- making-requests
|
|
163
|
-
- error-handling
|
|
164
|
-
- rate-limiting
|
|
165
|
-
|
|
166
|
-
- api:
|
|
167
|
-
text: "API Reference"
|
|
168
|
-
icon: "code"
|
|
169
|
-
collapsed: false
|
|
170
|
-
items:
|
|
171
|
-
- users
|
|
172
|
-
- products
|
|
173
|
-
- orders
|
|
174
|
-
|
|
175
|
-
- text: "GitHub"
|
|
176
|
-
link: "https://github.com/acme/api"
|
|
177
|
-
icon: "github-logo"
|
|
178
|
-
target: "_blank"
|
|
179
|
-
|
|
180
|
-
build:
|
|
181
|
-
output_dir: "dist"
|
|
182
|
-
base_url: "/api/"
|
|
183
|
-
clean: true
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Configuration Tips
|
|
187
|
-
|
|
188
|
-
::: tip Best Practices
|
|
189
|
-
1. **Start simple** - Add configuration as you need it
|
|
190
|
-
2. **Use icons consistently** - Pick a set and stick with it
|
|
191
|
-
3. **Organize logically** - Group related pages together
|
|
192
|
-
4. **Test base_url** - Preview with `docyard preview` before deploying
|
|
193
|
-
5. **Keep it maintainable** - Don't over-configure
|
|
194
|
-
:::
|
|
195
|
-
|
|
196
|
-
## Next Steps
|
|
197
|
-
|
|
198
|
-
::: note
|
|
199
|
-
- Learn about [markdown features](markdown-features)
|
|
200
|
-
- Check the [installation guide](../getting-started/installation)
|
|
201
|
-
- Start customizing your site!
|
|
202
|
-
:::
|