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,6 +1,23 @@
|
|
|
1
1
|
<aside class="sidebar" role="navigation" aria-label="Documentation navigation">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<% if @header_ctas&.any? %>
|
|
3
|
+
<div class="sidebar-ctas">
|
|
4
|
+
<% @header_ctas.sort_by { |cta| cta[:variant] == 'secondary' ? 0 : 1 }.each do |cta| %>
|
|
5
|
+
<a href="<%= cta[:external] ? cta[:href] : link_path(cta[:href]) %>"
|
|
6
|
+
class="sidebar-cta sidebar-cta--<%= cta[:variant] || 'primary' %>"
|
|
7
|
+
<%= 'target="_blank" rel="noopener noreferrer"' if cta[:external] %>>
|
|
8
|
+
<%= cta[:text] %>
|
|
9
|
+
<% if cta[:variant] != 'secondary' %>
|
|
10
|
+
<svg class="sidebar-cta-arrow" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
11
|
+
<path d="M9 5l7 7-7 7"/>
|
|
12
|
+
</svg>
|
|
13
|
+
<% end %>
|
|
14
|
+
</a>
|
|
15
|
+
<% end %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
18
|
+
<div class="sidebar-scroll">
|
|
19
|
+
<nav>
|
|
20
|
+
<%= @nav_content %>
|
|
21
|
+
</nav>
|
|
22
|
+
</div>
|
|
6
23
|
</aside>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<% if @has_tabs && @tabs&.any? %>
|
|
2
|
+
<nav class="tab-bar" aria-label="Main navigation">
|
|
3
|
+
<div class="tab-bar-content">
|
|
4
|
+
<% @tabs.each do |tab| %>
|
|
5
|
+
<a href="<%= tab[:external] ? tab[:href] : link_path(tab[:href]) %>"
|
|
6
|
+
class="tab-item<%= ' is-active' if tab[:active] %>"
|
|
7
|
+
<%= 'target="_blank" rel="noopener noreferrer"' if tab[:external] %>
|
|
8
|
+
data-tab-href="<%= tab[:href] %>">
|
|
9
|
+
<% if tab[:icon] %>
|
|
10
|
+
<span class="tab-icon"><%= icon(tab[:icon]) %></span>
|
|
11
|
+
<% end %>
|
|
12
|
+
<span><%= tab[:text] %></span>
|
|
13
|
+
<% if tab[:external] %>
|
|
14
|
+
<svg class="tab-external-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
15
|
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
|
|
16
|
+
<polyline points="15 3 21 3 21 9"></polyline>
|
|
17
|
+
<line x1="10" y1="14" x2="21" y2="3"></line>
|
|
18
|
+
</svg>
|
|
19
|
+
<% end %>
|
|
20
|
+
</a>
|
|
21
|
+
<% end %>
|
|
22
|
+
<div class="tab-indicator" id="tabIndicator"></div>
|
|
23
|
+
</div>
|
|
24
|
+
</nav>
|
|
25
|
+
<% end %>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<% unless @toc.empty? %>
|
|
2
|
-
<
|
|
3
|
-
<div class="docyard-
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
</
|
|
10
|
-
|
|
11
|
-
<nav id="toc-content" class="docyard-toc__nav">
|
|
2
|
+
<div class="docyard-toc" role="complementary" aria-label="Table of contents">
|
|
3
|
+
<div class="docyard-toc__scroll">
|
|
4
|
+
<div class="docyard-toc__header">
|
|
5
|
+
<h2 class="docyard-toc__title">
|
|
6
|
+
<%= icon(:table) %>
|
|
7
|
+
On this page
|
|
8
|
+
</h2>
|
|
9
|
+
</div>
|
|
10
|
+
<nav id="toc-content" class="docyard-toc__nav">
|
|
12
11
|
<ul class="docyard-toc__list">
|
|
13
12
|
<% @toc.each do |heading| %>
|
|
14
13
|
<li class="docyard-toc__item docyard-toc__item--level-<%= heading[:level] %>">
|
|
@@ -40,6 +39,7 @@
|
|
|
40
39
|
</li>
|
|
41
40
|
<% end %>
|
|
42
41
|
</ul>
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
</nav>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
45
|
<% end %>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<% unless @toc.empty? %>
|
|
2
2
|
<button class="secondary-header-toc-toggle" aria-expanded="false" aria-controls="toc-content" aria-label="Toggle table of contents">
|
|
3
3
|
<span>On this page</span>
|
|
4
|
-
|
|
5
|
-
<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/>
|
|
6
|
-
</svg>
|
|
4
|
+
<%= icon(:caret_down) %>
|
|
7
5
|
</button>
|
|
8
6
|
<% end %>
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
<% if tab[:icon] %>
|
|
14
14
|
<span class="docyard-tabs__icon">
|
|
15
15
|
<% if tab[:icon_source] == "file-extension" %>
|
|
16
|
-
<%=
|
|
16
|
+
<%= icon_file_extension(tab[:icon]) %>
|
|
17
17
|
<% elsif tab[:icon_source] == "phosphor" %>
|
|
18
|
-
<%=
|
|
18
|
+
<%= icon(tab[:icon]) %>
|
|
19
19
|
<% end %>
|
|
20
20
|
</span>
|
|
21
21
|
<% end %>
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
<button class="theme-toggle" aria-label="Toggle theme" title="Toggle theme">
|
|
2
|
-
<span class="theme-toggle-
|
|
3
|
-
|
|
4
|
-
<svg class="theme-toggle-icon theme-toggle-sun-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 256 256" fill="currentColor">
|
|
5
|
-
<path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"></path>
|
|
6
|
-
</svg>
|
|
7
|
-
<!-- Moon stars icon -->
|
|
8
|
-
<svg class="theme-toggle-icon theme-toggle-moon-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 256 256" fill="currentColor">
|
|
9
|
-
<path d="M240,96a8,8,0,0,1-8,8H216v16a8,8,0,0,1-16,0V104H184a8,8,0,0,1,0-16h16V72a8,8,0,0,1,16,0V88h16A8,8,0,0,1,240,96ZM144,56h8v8a8,8,0,0,0,16,0V56h8a8,8,0,0,0,0-16h-8V32a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16Zm72.77,97a8,8,0,0,1,1.43,8A96,96,0,1,1,95.07,37.8a8,8,0,0,1,10.6,9.06A88.07,88.07,0,0,0,209.14,150.33,8,8,0,0,1,216.77,153Zm-19.39,14.88c-1.79.09-3.59.14-5.38.14A104.11,104.11,0,0,1,88,64c0-1.79,0-3.59.14-5.38A80,80,0,1,0,197.38,167.86Z"></path>
|
|
10
|
-
</svg>
|
|
11
|
-
<span class="theme-toggle-thumb"></span>
|
|
12
|
-
</span>
|
|
2
|
+
<span class="theme-toggle-sun"><%= icon(:sun) %></span>
|
|
3
|
+
<span class="theme-toggle-moon"><%= icon(:moon_stars) %></span>
|
|
13
4
|
</button>
|
|
@@ -6,7 +6,8 @@ module Docyard
|
|
|
6
6
|
def self.normalize(path)
|
|
7
7
|
return "/" if path.nil? || path.empty?
|
|
8
8
|
|
|
9
|
-
normalized = path.delete_suffix("
|
|
9
|
+
normalized = path.delete_suffix("/")
|
|
10
|
+
.delete_suffix(".md")
|
|
10
11
|
.delete_suffix("/index")
|
|
11
12
|
|
|
12
13
|
normalized = "" if normalized == "index"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Docyard
|
|
4
|
+
module Utils
|
|
5
|
+
module UrlHelpers
|
|
6
|
+
def normalize_base_url(url)
|
|
7
|
+
return "/" if url.nil? || url.empty?
|
|
8
|
+
|
|
9
|
+
url = "/#{url}" unless url.start_with?("/")
|
|
10
|
+
url.end_with?("/") ? url : "#{url}/"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def link_path(path)
|
|
14
|
+
return path if path.nil? || path.start_with?("http://", "https://")
|
|
15
|
+
|
|
16
|
+
"#{base_url.chomp('/')}#{path}"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/docyard/version.rb
CHANGED
data/lib/docyard.rb
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Core modules
|
|
4
3
|
require_relative "docyard/version"
|
|
5
|
-
require_relative "docyard/constants"
|
|
6
|
-
require_relative "docyard/errors"
|
|
7
|
-
require_relative "docyard/logging"
|
|
4
|
+
require_relative "docyard/config/constants"
|
|
5
|
+
require_relative "docyard/utils/errors"
|
|
6
|
+
require_relative "docyard/utils/logging"
|
|
8
7
|
|
|
9
|
-
# Utilities
|
|
10
8
|
require_relative "docyard/utils/text_formatter"
|
|
11
9
|
require_relative "docyard/utils/path_resolver"
|
|
10
|
+
require_relative "docyard/utils/url_helpers"
|
|
11
|
+
require_relative "docyard/utils/html_helpers"
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
require_relative "docyard/
|
|
15
|
-
require_relative "docyard/
|
|
13
|
+
require_relative "docyard/server/resolution_result"
|
|
14
|
+
require_relative "docyard/server/router"
|
|
15
|
+
require_relative "docyard/server/asset_handler"
|
|
16
|
+
require_relative "docyard/server/dev_server"
|
|
17
|
+
require_relative "docyard/server/preview_server"
|
|
18
|
+
|
|
19
|
+
require_relative "docyard/rendering/markdown"
|
|
20
|
+
require_relative "docyard/rendering/renderer"
|
|
21
|
+
|
|
22
|
+
require_relative "docyard/navigation/sidebar_builder"
|
|
23
|
+
require_relative "docyard/navigation/prev_next_builder"
|
|
24
|
+
|
|
25
|
+
require_relative "docyard/config/branding_resolver"
|
|
16
26
|
|
|
17
|
-
# Application components
|
|
18
|
-
require_relative "docyard/markdown"
|
|
19
|
-
require_relative "docyard/renderer"
|
|
20
|
-
require_relative "docyard/asset_handler"
|
|
21
27
|
require_relative "docyard/initializer"
|
|
22
|
-
require_relative "docyard/server"
|
|
23
28
|
require_relative "docyard/cli"
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
require_relative "docyard/search/pagefind_support"
|
|
31
|
+
require_relative "docyard/search/dev_indexer"
|
|
32
|
+
require_relative "docyard/search/build_indexer"
|
|
33
|
+
|
|
26
34
|
require_relative "docyard/builder"
|
|
27
35
|
require_relative "docyard/build/static_generator"
|
|
28
36
|
require_relative "docyard/build/asset_bundler"
|
|
29
37
|
require_relative "docyard/build/file_copier"
|
|
30
38
|
require_relative "docyard/build/sitemap_generator"
|
|
31
|
-
require_relative "docyard/preview_server"
|
|
32
39
|
|
|
33
40
|
module Docyard
|
|
34
41
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docyard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sanif Himani
|
|
@@ -183,73 +183,94 @@ files:
|
|
|
183
183
|
- README.md
|
|
184
184
|
- Rakefile
|
|
185
185
|
- lib/docyard.rb
|
|
186
|
-
- lib/docyard/asset_handler.rb
|
|
187
186
|
- lib/docyard/build/asset_bundler.rb
|
|
188
187
|
- lib/docyard/build/file_copier.rb
|
|
189
188
|
- lib/docyard/build/sitemap_generator.rb
|
|
190
189
|
- lib/docyard/build/static_generator.rb
|
|
191
190
|
- lib/docyard/builder.rb
|
|
192
191
|
- lib/docyard/cli.rb
|
|
192
|
+
- lib/docyard/components/aliases.rb
|
|
193
193
|
- lib/docyard/components/base_processor.rb
|
|
194
|
-
- lib/docyard/components/callout_processor.rb
|
|
195
|
-
- lib/docyard/components/code_block_diff_preprocessor.rb
|
|
196
|
-
- lib/docyard/components/
|
|
197
|
-
- lib/docyard/components/
|
|
198
|
-
- lib/docyard/components/
|
|
199
|
-
- lib/docyard/components/
|
|
200
|
-
- lib/docyard/components/
|
|
201
|
-
- lib/docyard/components/
|
|
202
|
-
- lib/docyard/components/
|
|
203
|
-
- lib/docyard/components/
|
|
204
|
-
- lib/docyard/components/
|
|
205
|
-
- lib/docyard/components/code_snippet_import_preprocessor.rb
|
|
206
|
-
- lib/docyard/components/heading_anchor_processor.rb
|
|
207
|
-
- lib/docyard/components/icon_detector.rb
|
|
208
|
-
- lib/docyard/components/icon_processor.rb
|
|
194
|
+
- lib/docyard/components/processors/callout_processor.rb
|
|
195
|
+
- lib/docyard/components/processors/code_block_diff_preprocessor.rb
|
|
196
|
+
- lib/docyard/components/processors/code_block_focus_preprocessor.rb
|
|
197
|
+
- lib/docyard/components/processors/code_block_options_preprocessor.rb
|
|
198
|
+
- lib/docyard/components/processors/code_block_processor.rb
|
|
199
|
+
- lib/docyard/components/processors/code_snippet_import_preprocessor.rb
|
|
200
|
+
- lib/docyard/components/processors/heading_anchor_processor.rb
|
|
201
|
+
- lib/docyard/components/processors/icon_processor.rb
|
|
202
|
+
- lib/docyard/components/processors/table_of_contents_processor.rb
|
|
203
|
+
- lib/docyard/components/processors/table_wrapper_processor.rb
|
|
204
|
+
- lib/docyard/components/processors/tabs_processor.rb
|
|
209
205
|
- lib/docyard/components/registry.rb
|
|
210
|
-
- lib/docyard/components/
|
|
211
|
-
- lib/docyard/components/
|
|
212
|
-
- lib/docyard/components/
|
|
213
|
-
- lib/docyard/components/
|
|
214
|
-
- lib/docyard/components/
|
|
206
|
+
- lib/docyard/components/support/code_block/feature_extractor.rb
|
|
207
|
+
- lib/docyard/components/support/code_block/icon_detector.rb
|
|
208
|
+
- lib/docyard/components/support/code_block/line_parser.rb
|
|
209
|
+
- lib/docyard/components/support/code_block/line_wrapper.rb
|
|
210
|
+
- lib/docyard/components/support/code_block/patterns.rb
|
|
211
|
+
- lib/docyard/components/support/code_detector.rb
|
|
212
|
+
- lib/docyard/components/support/tabs/icon_detector.rb
|
|
213
|
+
- lib/docyard/components/support/tabs/parser.rb
|
|
214
|
+
- lib/docyard/components/support/tabs/range_finder.rb
|
|
215
215
|
- lib/docyard/config.rb
|
|
216
|
+
- lib/docyard/config/branding_resolver.rb
|
|
217
|
+
- lib/docyard/config/constants.rb
|
|
216
218
|
- lib/docyard/config/validator.rb
|
|
217
|
-
- lib/docyard/constants.rb
|
|
218
|
-
- lib/docyard/errors.rb
|
|
219
|
-
- lib/docyard/file_watcher.rb
|
|
220
|
-
- lib/docyard/icons.rb
|
|
221
|
-
- lib/docyard/icons/LICENSE.phosphor
|
|
222
|
-
- lib/docyard/icons/file_types.rb
|
|
223
|
-
- lib/docyard/icons/phosphor.rb
|
|
224
219
|
- lib/docyard/initializer.rb
|
|
225
|
-
- lib/docyard/
|
|
226
|
-
- lib/docyard/
|
|
227
|
-
- lib/docyard/
|
|
228
|
-
- lib/docyard/
|
|
229
|
-
- lib/docyard/
|
|
230
|
-
- lib/docyard/
|
|
231
|
-
- lib/docyard/
|
|
232
|
-
- lib/docyard/
|
|
233
|
-
- lib/docyard/
|
|
234
|
-
- lib/docyard/
|
|
235
|
-
- lib/docyard/sidebar/
|
|
236
|
-
- lib/docyard/sidebar/
|
|
237
|
-
- lib/docyard/sidebar/
|
|
238
|
-
- lib/docyard/sidebar/
|
|
239
|
-
- lib/docyard/sidebar/
|
|
240
|
-
- lib/docyard/sidebar/
|
|
241
|
-
- lib/docyard/sidebar_builder.rb
|
|
220
|
+
- lib/docyard/navigation/breadcrumb_builder.rb
|
|
221
|
+
- lib/docyard/navigation/prev_next_builder.rb
|
|
222
|
+
- lib/docyard/navigation/sidebar/children_discoverer.rb
|
|
223
|
+
- lib/docyard/navigation/sidebar/config_parser.rb
|
|
224
|
+
- lib/docyard/navigation/sidebar/file_resolver.rb
|
|
225
|
+
- lib/docyard/navigation/sidebar/file_system_scanner.rb
|
|
226
|
+
- lib/docyard/navigation/sidebar/item.rb
|
|
227
|
+
- lib/docyard/navigation/sidebar/local_config_loader.rb
|
|
228
|
+
- lib/docyard/navigation/sidebar/metadata_extractor.rb
|
|
229
|
+
- lib/docyard/navigation/sidebar/metadata_reader.rb
|
|
230
|
+
- lib/docyard/navigation/sidebar/path_prefixer.rb
|
|
231
|
+
- lib/docyard/navigation/sidebar/renderer.rb
|
|
232
|
+
- lib/docyard/navigation/sidebar/sorter.rb
|
|
233
|
+
- lib/docyard/navigation/sidebar/title_extractor.rb
|
|
234
|
+
- lib/docyard/navigation/sidebar/tree_builder.rb
|
|
235
|
+
- lib/docyard/navigation/sidebar/tree_filter.rb
|
|
236
|
+
- lib/docyard/navigation/sidebar_builder.rb
|
|
237
|
+
- lib/docyard/rendering/icon_helpers.rb
|
|
238
|
+
- lib/docyard/rendering/icons.rb
|
|
239
|
+
- lib/docyard/rendering/icons/LICENSE.phosphor
|
|
240
|
+
- lib/docyard/rendering/icons/file_types.rb
|
|
241
|
+
- lib/docyard/rendering/icons/phosphor.rb
|
|
242
|
+
- lib/docyard/rendering/language_mapping.rb
|
|
243
|
+
- lib/docyard/rendering/markdown.rb
|
|
244
|
+
- lib/docyard/rendering/renderer.rb
|
|
245
|
+
- lib/docyard/rendering/template_resolver.rb
|
|
246
|
+
- lib/docyard/routing/fallback_resolver.rb
|
|
247
|
+
- lib/docyard/search/build_indexer.rb
|
|
248
|
+
- lib/docyard/search/dev_indexer.rb
|
|
249
|
+
- lib/docyard/search/pagefind_support.rb
|
|
250
|
+
- lib/docyard/server/asset_handler.rb
|
|
251
|
+
- lib/docyard/server/dev_server.rb
|
|
252
|
+
- lib/docyard/server/file_watcher.rb
|
|
253
|
+
- lib/docyard/server/pagefind_handler.rb
|
|
254
|
+
- lib/docyard/server/preview_server.rb
|
|
255
|
+
- lib/docyard/server/rack_application.rb
|
|
256
|
+
- lib/docyard/server/resolution_result.rb
|
|
257
|
+
- lib/docyard/server/router.rb
|
|
242
258
|
- lib/docyard/templates/assets/css/code.css
|
|
259
|
+
- lib/docyard/templates/assets/css/components/breadcrumbs.css
|
|
243
260
|
- lib/docyard/templates/assets/css/components/callout.css
|
|
244
261
|
- lib/docyard/templates/assets/css/components/code-block.css
|
|
245
262
|
- lib/docyard/templates/assets/css/components/heading-anchor.css
|
|
246
263
|
- lib/docyard/templates/assets/css/components/icon.css
|
|
247
264
|
- lib/docyard/templates/assets/css/components/logo.css
|
|
265
|
+
- lib/docyard/templates/assets/css/components/nav-menu.css
|
|
248
266
|
- lib/docyard/templates/assets/css/components/navigation.css
|
|
249
267
|
- lib/docyard/templates/assets/css/components/prev-next.css
|
|
268
|
+
- lib/docyard/templates/assets/css/components/search.css
|
|
269
|
+
- lib/docyard/templates/assets/css/components/tab-bar.css
|
|
250
270
|
- lib/docyard/templates/assets/css/components/table-of-contents.css
|
|
251
271
|
- lib/docyard/templates/assets/css/components/tabs.css
|
|
252
272
|
- lib/docyard/templates/assets/css/components/theme-toggle.css
|
|
273
|
+
- lib/docyard/templates/assets/css/landing.css
|
|
253
274
|
- lib/docyard/templates/assets/css/layout.css
|
|
254
275
|
- lib/docyard/templates/assets/css/main.css
|
|
255
276
|
- lib/docyard/templates/assets/css/markdown.css
|
|
@@ -257,9 +278,13 @@ files:
|
|
|
257
278
|
- lib/docyard/templates/assets/css/typography.css
|
|
258
279
|
- lib/docyard/templates/assets/css/variables.css
|
|
259
280
|
- lib/docyard/templates/assets/favicon.svg
|
|
281
|
+
- lib/docyard/templates/assets/fonts/Inter-Variable.ttf
|
|
260
282
|
- lib/docyard/templates/assets/js/components/code-block.js
|
|
261
283
|
- lib/docyard/templates/assets/js/components/heading-anchor.js
|
|
262
284
|
- lib/docyard/templates/assets/js/components/navigation.js
|
|
285
|
+
- lib/docyard/templates/assets/js/components/search.js
|
|
286
|
+
- lib/docyard/templates/assets/js/components/sidebar-toggle.js
|
|
287
|
+
- lib/docyard/templates/assets/js/components/tab-navigation.js
|
|
263
288
|
- lib/docyard/templates/assets/js/components/table-of-contents.js
|
|
264
289
|
- lib/docyard/templates/assets/js/components/tabs.js
|
|
265
290
|
- lib/docyard/templates/assets/js/reload.js
|
|
@@ -270,29 +295,43 @@ files:
|
|
|
270
295
|
- lib/docyard/templates/errors/404.html.erb
|
|
271
296
|
- lib/docyard/templates/errors/500.html.erb
|
|
272
297
|
- lib/docyard/templates/layouts/default.html.erb
|
|
273
|
-
- lib/docyard/templates/
|
|
274
|
-
- lib/docyard/templates/
|
|
275
|
-
- lib/docyard/templates/markdown/guides/markdown-features.md.erb
|
|
276
|
-
- lib/docyard/templates/markdown/index.md.erb
|
|
298
|
+
- lib/docyard/templates/layouts/splash.html.erb
|
|
299
|
+
- lib/docyard/templates/partials/_breadcrumbs.html.erb
|
|
277
300
|
- lib/docyard/templates/partials/_callout.html.erb
|
|
278
301
|
- lib/docyard/templates/partials/_code_block.html.erb
|
|
302
|
+
- lib/docyard/templates/partials/_doc_footer.html.erb
|
|
303
|
+
- lib/docyard/templates/partials/_features.html.erb
|
|
304
|
+
- lib/docyard/templates/partials/_footer.html.erb
|
|
305
|
+
- lib/docyard/templates/partials/_head.html.erb
|
|
306
|
+
- lib/docyard/templates/partials/_header.html.erb
|
|
279
307
|
- lib/docyard/templates/partials/_heading_anchor.html.erb
|
|
308
|
+
- lib/docyard/templates/partials/_hero.html.erb
|
|
280
309
|
- lib/docyard/templates/partials/_icon.html.erb
|
|
281
310
|
- lib/docyard/templates/partials/_icon_file_extension.html.erb
|
|
282
311
|
- lib/docyard/templates/partials/_nav_group.html.erb
|
|
283
312
|
- lib/docyard/templates/partials/_nav_item.html.erb
|
|
284
313
|
- lib/docyard/templates/partials/_nav_leaf.html.erb
|
|
285
314
|
- lib/docyard/templates/partials/_nav_list.html.erb
|
|
315
|
+
- lib/docyard/templates/partials/_nav_menu.html.erb
|
|
316
|
+
- lib/docyard/templates/partials/_nav_nested_section.html.erb
|
|
286
317
|
- lib/docyard/templates/partials/_nav_section.html.erb
|
|
287
318
|
- lib/docyard/templates/partials/_prev_next.html.erb
|
|
319
|
+
- lib/docyard/templates/partials/_scripts.html.erb
|
|
320
|
+
- lib/docyard/templates/partials/_search_modal.html.erb
|
|
321
|
+
- lib/docyard/templates/partials/_search_trigger.html.erb
|
|
288
322
|
- lib/docyard/templates/partials/_sidebar.html.erb
|
|
289
323
|
- lib/docyard/templates/partials/_sidebar_footer.html.erb
|
|
324
|
+
- lib/docyard/templates/partials/_tab_bar.html.erb
|
|
290
325
|
- lib/docyard/templates/partials/_table_of_contents.html.erb
|
|
291
326
|
- lib/docyard/templates/partials/_table_of_contents_toggle.html.erb
|
|
292
327
|
- lib/docyard/templates/partials/_tabs.html.erb
|
|
293
328
|
- lib/docyard/templates/partials/_theme_toggle.html.erb
|
|
329
|
+
- lib/docyard/utils/errors.rb
|
|
330
|
+
- lib/docyard/utils/html_helpers.rb
|
|
331
|
+
- lib/docyard/utils/logging.rb
|
|
294
332
|
- lib/docyard/utils/path_resolver.rb
|
|
295
333
|
- lib/docyard/utils/text_formatter.rb
|
|
334
|
+
- lib/docyard/utils/url_helpers.rb
|
|
296
335
|
- lib/docyard/version.rb
|
|
297
336
|
- sig/docyard.rbs
|
|
298
337
|
homepage: https://github.com/sanifhimani/docyard
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../icons"
|
|
4
|
-
require_relative "../renderer"
|
|
5
|
-
require_relative "base_processor"
|
|
6
|
-
require "kramdown"
|
|
7
|
-
require "kramdown-parser-gfm"
|
|
8
|
-
|
|
9
|
-
module Docyard
|
|
10
|
-
module Components
|
|
11
|
-
class CalloutProcessor < BaseProcessor
|
|
12
|
-
self.priority = 10
|
|
13
|
-
|
|
14
|
-
CALLOUT_TYPES = {
|
|
15
|
-
"note" => { title: "Note", icon: "info", color: "note" },
|
|
16
|
-
"tip" => { title: "Tip", icon: "lightbulb", color: "tip" },
|
|
17
|
-
"important" => { title: "Important", icon: "warning-circle", color: "important" },
|
|
18
|
-
"warning" => { title: "Warning", icon: "warning", color: "warning" },
|
|
19
|
-
"danger" => { title: "Danger", icon: "siren", color: "danger" }
|
|
20
|
-
}.freeze
|
|
21
|
-
|
|
22
|
-
GITHUB_ALERT_TYPES = {
|
|
23
|
-
"NOTE" => "note",
|
|
24
|
-
"TIP" => "tip",
|
|
25
|
-
"IMPORTANT" => "important",
|
|
26
|
-
"WARNING" => "warning",
|
|
27
|
-
"CAUTION" => "danger"
|
|
28
|
-
}.freeze
|
|
29
|
-
|
|
30
|
-
def preprocess(markdown)
|
|
31
|
-
process_container_syntax(markdown)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def postprocess(html)
|
|
35
|
-
process_github_alerts(html)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def process_container_syntax(markdown)
|
|
41
|
-
markdown.gsub(/^:::[ \t]*(\w+)(?:[ \t]+([^\n]+?))?[ \t]*\n(.*?)^:::[ \t]*$/m) do
|
|
42
|
-
process_callout_match(Regexp.last_match(0), Regexp.last_match(1), Regexp.last_match(2), Regexp.last_match(3))
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def process_callout_match(original_match, type_raw, custom_title, content_markdown)
|
|
47
|
-
type = type_raw.downcase
|
|
48
|
-
return original_match unless CALLOUT_TYPES.key?(type)
|
|
49
|
-
|
|
50
|
-
config = CALLOUT_TYPES[type]
|
|
51
|
-
title = determine_title(custom_title, config[:title])
|
|
52
|
-
content_html = render_markdown_content(content_markdown.strip)
|
|
53
|
-
|
|
54
|
-
wrap_in_nomarkdown(render_callout_html(type, title, content_html, config[:icon]))
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def determine_title(custom_title, default_title)
|
|
58
|
-
title = custom_title&.strip
|
|
59
|
-
title.nil? || title.empty? ? default_title : title
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def render_markdown_content(content_markdown)
|
|
63
|
-
return "" if content_markdown.empty?
|
|
64
|
-
|
|
65
|
-
Kramdown::Document.new(
|
|
66
|
-
content_markdown,
|
|
67
|
-
input: "GFM",
|
|
68
|
-
hard_wrap: false,
|
|
69
|
-
syntax_highlighter: "rouge"
|
|
70
|
-
).to_html
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def wrap_in_nomarkdown(html)
|
|
74
|
-
"{::nomarkdown}\n#{html}\n{:/nomarkdown}"
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def process_github_alerts(html)
|
|
78
|
-
github_alert_regex = %r{
|
|
79
|
-
<blockquote>\s*
|
|
80
|
-
<p>\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*
|
|
81
|
-
(?:<br\s*/>)?\s*
|
|
82
|
-
(.*?)</p>
|
|
83
|
-
(.*?)
|
|
84
|
-
</blockquote>
|
|
85
|
-
}mx
|
|
86
|
-
|
|
87
|
-
html.gsub(github_alert_regex) do
|
|
88
|
-
process_github_alert_match(Regexp.last_match(1), Regexp.last_match(2), Regexp.last_match(3))
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def process_github_alert_match(alert_type, first_para, rest_content)
|
|
93
|
-
type = GITHUB_ALERT_TYPES[alert_type]
|
|
94
|
-
config = CALLOUT_TYPES[type]
|
|
95
|
-
content_html = combine_alert_content(first_para.strip, rest_content.strip)
|
|
96
|
-
|
|
97
|
-
render_callout_html(type, config[:title], content_html, config[:icon])
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def combine_alert_content(first_para, rest_content)
|
|
101
|
-
return "<p>#{first_para}</p>" if rest_content.empty?
|
|
102
|
-
|
|
103
|
-
"<p>#{first_para}</p>#{rest_content}"
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def render_callout_html(type, title, content_html, icon_name)
|
|
107
|
-
icon_svg = Icons.render(icon_name, "duotone") || ""
|
|
108
|
-
renderer = Renderer.new
|
|
109
|
-
|
|
110
|
-
renderer.render_partial(
|
|
111
|
-
"_callout", {
|
|
112
|
-
type: type,
|
|
113
|
-
title: title,
|
|
114
|
-
content_html: content_html,
|
|
115
|
-
icon_svg: icon_svg
|
|
116
|
-
}
|
|
117
|
-
)
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
end
|