jekyll-theme-centos 2.52.0.beta.95 → 2.52.0.beta.96

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 514d7cf7b23b5a2233b00dd34553cc9be81540fafc2fef9a3e3bdcd223355140
4
- data.tar.gz: 11d9d4be1415ddf484b5f1c590fab9a79fb26d24a77e49724f93649d6680444f
3
+ metadata.gz: f5d7826e37033ad225ba8f67091b714b4486821b56ddb41b7259c9593f6f777a
4
+ data.tar.gz: 859ec7818eee6e8fdba4f1d97e439c2ba2318422b864f43180b1ba1b0fb6e757
5
5
  SHA512:
6
- metadata.gz: ea8fca5a2626aaab45cef3f673115e3a4260f6ff5b9d31e9b436b5bb304413d879df61e586316fb2ff38bf58ceba27c6e99bdd89412b38f17a42f6d4b9cde8bd
7
- data.tar.gz: c8f7a9cfc0ea451c92192656de898a3c2add1219a4ffa08eb4758520b48bbdc59ffe4ce82ed506d46fce7961228d407384524405e7798ee88873b50c4a2253c1
6
+ metadata.gz: 944084fc09f8ac08efc3e7d6d054b4f8e33d4a415cf2d534422dd3241c62298d132bf1e624002d0f4877ac03a189fceeb6fe5ae3cf3968af60f8741a450cbf08
7
+ data.tar.gz: 18e70fcc850b108ce04909d329475a2498eb77f78d07f72f17c225ce896ff34d5796d48bbf9474a24e87363b301e61ee01bab95c38946565adf627a2e65d18e0
data/_config.yml CHANGED
@@ -174,10 +174,6 @@ with_link_decorator_data:
174
174
  - img
175
175
 
176
176
  with_heading_anchor: true
177
- with_heading_anchor_data:
178
- icon: "fa-solid fa-hashtag"
179
- copy_success_message: "Copied!"
180
- reset_delay: 2000
181
177
 
182
178
  with_minify: true
183
179
  with_minify_data:
@@ -1,2 +1,4 @@
1
1
  ---
2
- class: col
2
+ class: "container py-3"
3
+ row_class: "row mb-3"
4
+ col_class: col
@@ -1,15 +1,22 @@
1
1
  title: Content Section Configuration
2
2
  description: >-
3
- Schema for configuring the main content display partial. This controls the
4
- rendering and layout of the primary content area on a page.
3
+ Schema for configuring the content component, which owns the <main>
4
+ element in the default layout. This controls the rendering of the entire
5
+ main page body — the announcement, bits, event, breadcrumb, title,
6
+ artwork, and table of contents components nested inside <main>, followed
7
+ by the page's own converted Markdown or HTML content — as well as the
8
+ layout of that content area.
5
9
  type: object
6
10
  properties:
7
11
  with_content:
8
12
  type: boolean
9
13
  default: true
10
14
  description: >-
11
- Enables or disables the rendering of the content section. Set to `true`
12
- (default) to display the content area; set to `false` to hide it entirely.
15
+ Enables or disables the rendering of the <main> element and every
16
+ component nested inside it (announcement, bits, event, breadcrumb,
17
+ title, artwork, toc, and the page's own content). Set to `true`
18
+ (default) to display the main content region; set to `false` to omit
19
+ `<main>` entirely from the rendered page.
13
20
  with_content_data:
14
21
  type: object
15
22
  description: >-
@@ -17,10 +24,29 @@ properties:
17
24
  rendered content section.
18
25
  properties:
19
26
  class:
27
+ type: string
28
+ default: "container py-3"
29
+ description: >-
30
+ Custom Bootstrap class(es) applied to the `<main>` element itself
31
+ — the outermost element owned by this component. Controls the
32
+ outer container behavior (max-width constraint, vertical padding)
33
+ for the entire main page body.
34
+ row_class:
35
+ type: string
36
+ default: "row mb-3"
37
+ description: >-
38
+ Custom Bootstrap class(es) applied to the `div.row` that wraps the
39
+ content section's `div.col` container. This same class is also
40
+ passed to the breadcrumb, title, artwork, and toc components, so
41
+ every row inside `<main>` shares the same spacing.
42
+ col_class:
20
43
  type: string
21
44
  default: col
22
45
  description: >-
23
- A Bootstrap column class used to control the width and responsiveness of the content section container (e.g., `col`, `col-md-10`, `col-lg-8`).
24
- This dictates the column size within the grid system.
46
+ A Bootstrap column class used to control the width and
47
+ responsiveness of the content section's `div.col` container (e.g.,
48
+ `col`, `col-md-10`, `col-lg-8`). This same class is also passed to
49
+ the breadcrumb, title, artwork, and toc components, so the whole
50
+ page moves as one aligned column.
25
51
  additionalProperties: false # Added to restrict unexpected properties in the data object
26
52
  additionalProperties: false
@@ -2,6 +2,7 @@
2
2
  #
3
3
  # site.data.base.footer - Control footer branding.
4
4
  #
5
+ class: "footer small bg-dark text-centos-purple-100 pt-5"
5
6
  brand_image: "centos-whitelogo.svg"
6
7
  brand_image_class: ""
7
8
  brand_image_height: "32"
@@ -20,6 +20,12 @@ properties:
20
20
  defined here (in the page's front matter) override any global `footer`
21
21
  data defined in site-wide `_data` files.
22
22
  properties:
23
+ class:
24
+ type: string
25
+ default: "footer small bg-dark text-centos-purple-100 pt-5"
26
+ description: >-
27
+ Custom Bootstrap class(es) applied to the `<footer>` element
28
+ itself — the outermost element owned by this component.
23
29
  brand_image:
24
30
  type: string
25
31
  default: "centos-whitelogo.svg"
@@ -1,2 +1,2 @@
1
1
  ---
2
- icon: "fa-solid fa-hashtag"
2
+ icon: "heading-anchor-hash pe-1"
@@ -2,8 +2,8 @@
2
2
  title: Heading Anchor Component Configuration
3
3
  description: >
4
4
  Configuration for the first-class heading anchor feature of jekyll-link-decorator.
5
- Each heading (h1–h6) receives a Font Awesome link icon that, when clicked, copies
6
- the full page URL with fragment to the clipboard.
5
+ Each heading (h1–h6) receives a permalink: an anchor with a hover/focus-revealed
6
+ glyph, linking to the heading itself.
7
7
  type: object
8
8
  properties:
9
9
  with_heading_anchor:
@@ -12,26 +12,16 @@ properties:
12
12
  default: true
13
13
  with_heading_anchor_data:
14
14
  type: object
15
- description: Configuration for heading anchor appearance and copy behaviour.
15
+ description: Configuration for heading anchor appearance.
16
16
  properties:
17
17
  icon:
18
18
  type: string
19
- description: Font Awesome icon classes applied to the anchor icon element.
20
- default: "fa-solid fa-hashtag"
19
+ description: >
20
+ CSS classes applied to the anchor's glyph element. Defaults to a plain
21
+ "#" character rendered via the .heading-anchor-hash class.
22
+ default: "heading-anchor-hash pe-1"
21
23
  icon_size:
22
24
  type: string
23
25
  description: Font Awesome size modifier appended after the icon classes.
24
- copy_success_message:
25
- type: string
26
- description: >
27
- Feedback message shown after a successful clipboard copy.
28
- Consumed by heading-anchor.js via data-success-message on the script element.
29
- default: "Copied!"
30
- reset_delay:
31
- type: integer
32
- description: >
33
- Milliseconds to wait before the icon resets to its original state
34
- after a successful copy. Consumed by heading-anchor.js via data-reset-delay.
35
- default: 2000
36
26
  additionalProperties: false
37
27
  additionalProperties: false
@@ -19,6 +19,9 @@ Optional Inputs:
19
19
  - data: Artwork data object (overrides fallbacks)
20
20
  - column_class: Bootstrap column class for the row wrapper (set by the layout to
21
21
  keep this component aligned with the content column; defaults to "col")
22
+ - row_class: Bootstrap class(es) for the row wrapper (set by the layout to
23
+ keep this component's row aligned with breadcrumb, title, toc, and
24
+ content; defaults to "row mb-3")
22
25
 
23
26
  Data Source Hierarchy (priority):
24
27
  1. include.data
@@ -49,9 +52,10 @@ Data Source Hierarchy (priority):
49
52
  {%- assign artwork_class = with_artwork_data.class | default: with_artwork_schema.class.default %}
50
53
  {%- assign artwork_image_class = with_artwork_data.image_class | default: with_artwork_schema.image_class.default %}
51
54
  {%- assign column_class = include.column_class | default: 'col' %}
55
+ {%- assign row_class = include.row_class | default: 'row mb-3' %}
52
56
 
53
57
  {%- comment %} --- HTML --- {% endcomment %}
54
- <div class="row mb-3">
58
+ <div class="{{ row_class }}">
55
59
  <div class="{{ column_class }}">
56
60
  <div class="{{ artwork_class }}">
57
61
  <div class="{{ artwork_image_class }}" role="img" aria-label="{{ artwork_alt }}"></div>
@@ -22,6 +22,9 @@ Optional Inputs:
22
22
  - with_breadcrumb_data.arialabel: aria-label for the <nav> element (default: "breadcrumb")
23
23
  - column_class (include param): Bootstrap column class for the row wrapper (set by
24
24
  the layout to keep this component aligned with the content column; defaults to "col")
25
+ - row_class (include param): Bootstrap class(es) for the row wrapper (set by
26
+ the layout to keep this component's row aligned with title, artwork, toc,
27
+ and content; defaults to "row mb-3")
25
28
 
26
29
  Data Source Hierarchy:
27
30
  - with_breadcrumb: include.with_breadcrumb → page.with_breadcrumb
@@ -50,10 +53,11 @@ Data Source Hierarchy:
50
53
  {%- assign detected_locale = page.locale | default: 'en' %}
51
54
 
52
55
  {%- assign column_class = include.column_class | default: 'col' %}
56
+ {%- assign row_class = include.row_class | default: 'row mb-3' %}
53
57
 
54
- <div class="row small mb-3">
58
+ <div class="{{ row_class }}">
55
59
  <div class="{{ column_class }}">
56
- <nav aria-label="{{ with_breadcrumb_data.arialabel | default: with_breadcrumb_schema.arialabel.default | default: 'breadcrumb' }}">
60
+ <nav class="small" aria-label="{{ with_breadcrumb_data.arialabel | default: with_breadcrumb_schema.arialabel.default | default: 'breadcrumb' }}">
57
61
  <ol class="breadcrumb mb-0">
58
62
  {%- comment %} Home link - adjust for locale {%- endcomment %}
59
63
  {%- if detected_locale == 'en' or detected_locale == '' %}
@@ -8,19 +8,49 @@
8
8
  | default: site.data.base.content
9
9
  -%}
10
10
 
11
+ {%- assign content_schema_key = "content_schema" %}
12
+ {%- assign content_schema = include.schema
13
+ | default: site.data[content_schema_key]
14
+ | default: site.data.base[content_schema_key]
15
+ -%}
16
+
17
+ {%- assign class = include.class
18
+ | default: with_content_data.class
19
+ | default: content_schema.properties.with_content_data.properties.class.default
20
+ | default: 'container py-3' -%}
21
+
22
+ {%- assign row_class = include.row_class
23
+ | default: with_content_data.row_class
24
+ | default: content_schema.properties.with_content_data.properties.row_class.default
25
+ | default: 'row mb-3' -%}
26
+
27
+ {%- assign col_class = include.col_class
28
+ | default: with_content_data.col_class
29
+ | default: content_schema.properties.with_content_data.properties.col_class.default
30
+ | default: 'col' -%}
31
+
11
32
  {%- if with_content -%}
12
- {%- assign content_schema_key = "content_schema" %}
13
- {%- assign content_schema = include.schema
14
- | default: site.data[content_schema_key]
15
- | default: site.data.base[content_schema_key]
16
- -%}
17
- {%- assign class = include.column_class
18
- | default: with_content_data.class
19
- | default: content_schema.properties.with_content_data.properties.class.default
20
- | default: 'col' -%}
21
- <div class="row mb-3">
22
- <div class="{{ class }} content">
33
+ <main class="{{ class }}">
34
+
35
+ {%- include base/announcement.html.liquid %}
36
+
37
+ {% include base/bits.html.liquid %}
38
+
39
+ {% include base/event.html.liquid %}
40
+
41
+ {% include base/breadcrumb.html.liquid column_class=col_class row_class=row_class %}
42
+
43
+ {% include base/title.html.liquid column_class=col_class row_class=row_class %}
44
+
45
+ {% include base/artwork.html.liquid column_class=col_class row_class=row_class %}
46
+
47
+ {% include base/toc.html.liquid column_class=col_class row_class=row_class %}
48
+
49
+ <div class="{{ row_class }}">
50
+ <div class="{{ col_class }} content">
23
51
  {{ content }}
24
52
  </div>
25
53
  </div>
54
+
55
+ </main>
26
56
  {%- endif -%}
@@ -10,16 +10,17 @@
10
10
 
11
11
  {%- if with_footer -%}
12
12
 
13
- <footer class="footer small bg-dark text-centos-purple-100 pt-5">
14
-
15
13
  {%- assign with_footer_schema = site.data.base.footer_schema.properties.with_footer_data.properties %}
16
14
 
15
+ {%- assign footer_class = with_footer_data.class | default: with_footer_schema.class.default %}
17
16
  {%- assign footer_brand_image = with_footer_data.brand_image | default: with_footer_schema.brand_image.default %}
18
17
  {%- assign footer_brand_image_class = with_footer_data.brand_image_class | default: with_footer_schema.brand_image_class.default %}
19
18
  {%- assign footer_brand_image_height = with_footer_data.brand_image_height | default: with_footer_schema.brand_image_height.default %}
20
19
  {%- assign footer_brand_manifestation = with_footer_data.brand_manifestation | default: with_footer_schema.brand_manifestation.default %}
21
20
  {%- assign footer_brand_manifestation_class = with_footer_data.brand_manifestation_class | default: with_footer_schema.brand_manifestation_class.default %}
22
21
 
22
+ <footer class="{{ footer_class }}">
23
+
23
24
  <div class="container">
24
25
  <div class="row justify-content-between align-items-start gx-5">
25
26
  <div class="col-sm-12 col-lg-4">
@@ -29,7 +29,6 @@ Optional Inputs:
29
29
  - page.with_breakingnews_data: Array of breaking news items
30
30
  - page.with_backtotop: Include back-to-top button (boolean)
31
31
  - page.with_copyvalue: Include copy-to-clipboard behavior (boolean)
32
- - page.with_heading_anchor: Include heading anchor copy behavior (boolean)
33
32
  - page.theme_color, site.theme_color: Override browser chrome color (default: #A54C93)
34
33
  ================================================================================
35
34
  {% endcomment %}
@@ -141,5 +140,4 @@ Uses CSS custom properties for cleaner, more maintainable dynamic styling.
141
140
  {%- comment %} JavaScript UI behavior components — depend on Bootstrap and FontAwesome SVG+JS {%- endcomment %}
142
141
  {%- include base/backtotop.html.liquid %}
143
142
  {%- include base/copyvalue.html.liquid %}
144
- {%- include base/heading_anchor.html.liquid %}
145
143
  </head>
@@ -24,6 +24,9 @@ Optional Inputs (from include):
24
24
  - data: Title configuration object
25
25
  - column_class: Bootstrap column class for the row wrapper (set by the layout to
26
26
  keep this component aligned with the content column; defaults to "col")
27
+ - row_class: Bootstrap class(es) for the row wrapper (set by the layout to
28
+ keep this component's row aligned with breadcrumb, artwork, toc, and
29
+ content; defaults to "row mb-3")
27
30
 
28
31
  Data Source Hierarchy (in priority order):
29
32
  1. include.data - Explicitly passed configuration
@@ -57,8 +60,9 @@ Conditional Logic:
57
60
  {%- assign title_lead = with_title_data.title_lead | default: page.title_lead %}
58
61
  {%- assign title_lead_class = with_title_data.title_lead_class | default: with_title_schema.title_lead_class.default %}
59
62
  {%- assign column_class = include.column_class | default: 'col' %}
63
+ {%- assign row_class = include.row_class | default: 'row mb-3' %}
60
64
 
61
- <div class="row mb-3">
65
+ <div class="{{ row_class }}">
62
66
  <div class="{{ column_class }}">
63
67
  <div class="{{ class }}">
64
68
  <p class="{{ title_class }}">{{ title }}</p>
@@ -33,6 +33,9 @@ Optional Inputs (from include):
33
33
  - data: TOC configuration object
34
34
  - column_class: Bootstrap column class for the row wrapper (set by the layout to
35
35
  keep this component aligned with the content column; defaults to "col")
36
+ - row_class: Bootstrap class(es) for the row wrapper (set by the layout to
37
+ keep this component's row aligned with breadcrumb, title, artwork, and
38
+ content; defaults to "row mb-3")
36
39
 
37
40
  Data Source Hierarchy (in priority order):
38
41
  - with_toc: include.with_toc → page.with_toc
@@ -62,11 +65,12 @@ Data Source Hierarchy (in priority order):
62
65
  {%- assign skip_no_ids = with_toc_data.skip_no_ids | default: with_toc_schema["skip_no_ids"].default %}
63
66
  {%- assign flat_toc = with_toc_data.flat_toc | default: with_toc_schema["flat_toc"].default %}
64
67
  {%- assign column_class = include.column_class | default: 'col' %}
68
+ {%- assign row_class = include.row_class | default: 'row mb-3' %}
65
69
 
66
70
  {%- comment %} === Presentation === {% endcomment %}
67
71
 
68
72
  {%- comment %} --- HTML --- {% endcomment %}
69
- <div class="row mb-3">
73
+ <div class="{{ row_class }}">
70
74
  <div class="{{ column_class }}">
71
75
  <div class="accordion shadow-sm" id="pageToc">
72
76
  <div class="accordion-item">
@@ -1,7 +1,7 @@
1
1
  <!doctype html>
2
2
  <html lang="{{ page.lang | default: 'en' }}"{% if page.with_ogp %} prefix="og: https://ogp.me/ns#"{% endif %}>
3
3
  {% include base/head.html.liquid -%}
4
- <body id="top" class="bg-body{% if page.with_navbar %} has-navbar{% endif %}">
4
+ <body id="top" class="{{ page.body_class | default: 'bg-body' }}{% if page.with_navbar %} has-navbar{% endif %}">
5
5
 
6
6
  {% include base/navbar.html.liquid -%}
7
7
 
@@ -9,34 +9,7 @@
9
9
 
10
10
  {% include base/breakingnews.html.liquid -%}
11
11
 
12
- {%- assign with_content_data = page.with_content_data
13
- | default: site.data.content
14
- | default: site.data.base.content
15
- -%}
16
- {%- assign content_schema = site.data.content_schema | default: site.data.base.content_schema -%}
17
- {%- assign content_class = with_content_data.class
18
- | default: content_schema.properties.with_content_data.properties.class.default
19
- | default: 'col' -%}
20
-
21
- <main class="container py-3">
22
-
23
- {%- include base/announcement.html.liquid %}
24
-
25
- {% include base/bits.html.liquid %}
26
-
27
- {% include base/event.html.liquid %}
28
-
29
- {% include base/breadcrumb.html.liquid column_class=content_class %}
30
-
31
- {% include base/title.html.liquid column_class=content_class %}
32
-
33
- {% include base/artwork.html.liquid column_class=content_class %}
34
-
35
- {% include base/toc.html.liquid column_class=content_class %}
36
-
37
- {% include base/content.html.liquid column_class=content_class %}
38
-
39
- </main>
12
+ {% include base/content.html.liquid %}
40
13
 
41
14
  {% include base/footer.html.liquid %}
42
15
  </body>
@@ -281,13 +281,13 @@ main {
281
281
  opacity: 1;
282
282
  transform: translateX(-100%);
283
283
  }
284
- .heading-anchor.is-active {
285
- opacity: 1 !important;
286
- visibility: visible !important;
287
- transform: translateX(-100%) !important;
284
+ // Plain "#" glyph — replaces the Font Awesome icon so this component has no
285
+ // icon-font dependency; font-style reset since it's text, not an icon glyph.
286
+ .heading-anchor-hash {
287
+ font-style: normal;
288
288
  }
289
- .heading-anchor.is-active i {
290
- color: var(--bs-primary);
289
+ .heading-anchor-hash::before {
290
+ content: "#";
291
291
  }
292
292
 
293
293
  // Accordion containers' bottom clearance — same as the headings/figure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-centos
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.52.0.beta.95
4
+ version: 2.52.0.beta.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alain Reguera Delgado
@@ -358,7 +358,6 @@ files:
358
358
  - _includes/base/fontawesome.html.liquid
359
359
  - _includes/base/footer.html.liquid
360
360
  - _includes/base/head.html.liquid
361
- - _includes/base/heading_anchor.html.liquid
362
361
  - _includes/base/highlight.html.liquid
363
362
  - _includes/base/image.html.liquid
364
363
  - _includes/base/link.html.liquid
@@ -518,7 +517,6 @@ files:
518
517
  - assets/js/base/backtotop.js
519
518
  - assets/js/base/copyvalue.js
520
519
  - assets/js/base/datatable.js
521
- - assets/js/base/heading-anchor.js
522
520
  - assets/js/base/highlight.js
523
521
  - assets/js/base/init-tooltips.js
524
522
  - assets/js/bootstrap.bundle.js
@@ -1,67 +0,0 @@
1
- {% comment %}
2
- ================================================================================
3
- Template: Heading Anchor Component
4
- Purpose: Loads heading-anchor.js which wires click-to-copy behaviour on anchor
5
- icons that jekyll-link-decorator injects inside h1–h6 elements. Clicking an
6
- anchor icon copies the full page URL (origin + pathname + fragment) to the
7
- clipboard, with a transient fa-check icon as visual feedback.
8
-
9
- Recommended Usage (in head.html.liquid):
10
- {%- include base/heading_anchor.html.liquid %}
11
-
12
- The heading anchor icons themselves are injected by the jekyll-link-decorator
13
- Ruby plugin. This include only loads the JavaScript that powers copy behaviour.
14
-
15
- Required Inputs (from HTML elements produced by the plugin):
16
- - class="heading-anchor" : Selector used to attach click handlers
17
- - data-copy-anchor="#id" : Fragment to append to the current page URL
18
-
19
- Optional Inputs (from data objects):
20
- - reset_delay : Milliseconds before icon resets (default from schema)
21
- - copy_success_message : Not consumed by JS directly; available for reference
22
-
23
- Data Source Hierarchy (in priority order):
24
- 1. include.data - Explicitly passed configuration
25
- 2. page.with_heading_anchor_data - Page front matter
26
- 3. site.data.heading_anchor - Site configuration
27
- 4. site.data.base.heading_anchor - Theme defaults
28
-
29
- Dependencies:
30
- jekyll-link-decorator gem, FontAwesome 6+, Clipboard API (modern browsers)
31
- ================================================================================
32
- {% endcomment %}
33
-
34
- {%- assign with_heading_anchor = include.with_heading_anchor
35
- | default: page.with_heading_anchor
36
- | default: site.with_heading_anchor
37
- -%}
38
-
39
- {%- assign with_heading_anchor_data = include.data
40
- | default: page.with_heading_anchor_data
41
- | default: site.data.heading_anchor
42
- | default: site.data.base.heading_anchor
43
- -%}
44
-
45
- {%- assign with_heading_anchor_schema = site.data.base.heading_anchor_schema.properties.with_heading_anchor_data.properties -%}
46
-
47
- {%- if with_heading_anchor -%}
48
-
49
- {%- comment %} === Presentation === {% endcomment %}
50
-
51
- {%- comment %} --- Defaults --- {% endcomment %}
52
- {%- assign heading_anchor_reset_delay = with_heading_anchor_data.reset_delay | default: with_heading_anchor_schema.reset_delay.default -%}
53
- {%- assign heading_anchor_success_message = with_heading_anchor_data.copy_success_message | default: with_heading_anchor_schema.copy_success_message.default -%}
54
-
55
- {%- comment %} --- HTML --- {% endcomment %}
56
- <!-- Load Heading Anchor functionality with configuration via data attributes -->
57
- <script id="centos-heading-anchor"
58
- {%- if with_heading_anchor_data.reset_delay %}
59
- data-reset-delay="{{ heading_anchor_reset_delay }}"
60
- {%- endif %}
61
- {%- if with_heading_anchor_data.copy_success_message %}
62
- data-success-message="{{ heading_anchor_success_message }}"
63
- {%- endif %}
64
- src="{{ site.baseurl }}/assets/js/base/heading-anchor.min.js"
65
- defer></script>
66
-
67
- {%- endif -%}
@@ -1,109 +0,0 @@
1
- // Heading Anchor Component — requires Bootstrap >= 5.3 (tooltip.setContent) and Font Awesome 6+
2
-
3
- document.addEventListener('DOMContentLoaded', () => {
4
- if (typeof bootstrap === 'undefined') {
5
- console.warn('heading-anchor: Bootstrap not available')
6
- return
7
- }
8
-
9
- const DEFAULT_TEXT = 'Copy link'
10
- const scriptEl = document.getElementById('centos-heading-anchor')
11
- const RESET_DELAY = scriptEl?.dataset.resetDelay
12
- ? parseInt(scriptEl.dataset.resetDelay, 10) : 2000
13
- const SUCCESS_TEXT = scriptEl?.dataset.successMessage || 'Copied!'
14
-
15
- // One shared region: multiple regions would cause simultaneous AT announcements per anchor.
16
- let liveRegion = document.getElementById('centos-heading-anchor-live')
17
- if (!liveRegion) {
18
- liveRegion = document.createElement('div')
19
- liveRegion.id = 'centos-heading-anchor-live'
20
- liveRegion.setAttribute('aria-live', 'polite')
21
- liveRegion.setAttribute('aria-atomic', 'true')
22
- liveRegion.className = 'visually-hidden'
23
- document.body.appendChild(liveRegion)
24
- }
25
-
26
- document.querySelectorAll('.heading-anchor[data-copy-anchor]').forEach(anchor => {
27
- // FA SVG+JS replaces <i> with <svg> before this DOMContentLoaded fires.
28
- // Cache innerHTML after FA has processed so it can be restored on reset.
29
- const originalIconHTML = anchor.innerHTML
30
- // Guards blur/mouseenter handlers from collapsing the tooltip during the success window.
31
- let isLocked = false
32
-
33
- const tooltip = new bootstrap.Tooltip(anchor, {
34
- title: DEFAULT_TEXT,
35
- trigger: 'manual', // CSS sets pointer-events:none on hidden anchors, defeating Bootstrap's auto hover/focus triggers.
36
- placement: 'top',
37
- animation: false // Prevents Bootstrap's fade and the CSS opacity transition from desyncing.
38
- })
39
-
40
- const updateUI = (isSuccess) => {
41
- tooltip.setContent({ '.tooltip-inner': isSuccess ? SUCCESS_TEXT : DEFAULT_TEXT })
42
- if (isSuccess) {
43
- // FA SVG+JS mode: <i> has been replaced by <svg>; swap the path to a checkmark.
44
- const svg = anchor.querySelector('svg')
45
- if (svg) {
46
- const path = svg.querySelector('path')
47
- if (path) {
48
- svg.setAttribute('viewBox', '0 0 448 512')
49
- path.setAttribute('d', 'M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z')
50
- }
51
- } else {
52
- // FA webfont mode: <i> is still in the DOM; toggle classes normally.
53
- const icon = anchor.querySelector('i')
54
- if (icon) { icon.classList.remove('fa-hashtag'); icon.classList.add('fa-check') }
55
- }
56
- } else {
57
- anchor.innerHTML = originalIconHTML
58
- }
59
- anchor.classList.toggle('is-active', isSuccess)
60
- // Empty string on reset prevents AT from re-announcing stale text on DOM inspection.
61
- liveRegion.textContent = isSuccess ? SUCCESS_TEXT : ''
62
- if (isSuccess) tooltip.show()
63
- }
64
-
65
- const handleInteraction = (show) => {
66
- if (!isLocked) show ? tooltip.show() : tooltip.hide()
67
- }
68
-
69
- anchor.addEventListener('mouseenter', () => handleInteraction(true))
70
- anchor.addEventListener('mouseleave', () => handleInteraction(false))
71
- anchor.addEventListener('focus', () => handleInteraction(true))
72
- anchor.addEventListener('blur', () => handleInteraction(false))
73
-
74
- anchor.addEventListener('click', async (e) => {
75
- e.preventDefault()
76
- anchor.closest('h1, h2, h3, h4, h5, h6')?.scrollIntoView()
77
- if (isLocked) return
78
-
79
- if (!navigator.clipboard) {
80
- console.warn('heading-anchor: Clipboard API unavailable')
81
- return
82
- }
83
-
84
- const url = window.location.origin + window.location.pathname + anchor.dataset.copyAnchor
85
-
86
- try {
87
- await navigator.clipboard.writeText(url)
88
- isLocked = true
89
- // isLocked must be true before blur() so the resulting blur event is suppressed
90
- // and does not hide the tooltip before the success state has been rendered.
91
- anchor.blur()
92
- updateUI(true)
93
-
94
- setTimeout(() => {
95
- isLocked = false
96
- updateUI(false)
97
- // mouseleave/blur events fired while isLocked was true were suppressed;
98
- // hide now if the user already moved away during the success window.
99
- if (!anchor.matches(':hover')) tooltip.hide()
100
- }, RESET_DELAY)
101
-
102
- } catch (err) {
103
- console.warn('heading-anchor: clipboard write failed', err)
104
- isLocked = false
105
- anchor.innerHTML = originalIconHTML
106
- }
107
- })
108
- })
109
- })