markdowndocs 0.11.0 → 0.11.2

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: 4066fc2cf3c03c9f743aaaab41c62611b5206ef9d0dad6cdead66c02f39eba29
4
- data.tar.gz: 9594a84833fca33b4ec4d4a6c81efd1cc21d28e57fddca30f1f4765073ced9bb
3
+ metadata.gz: 28f9775decd9995a54bf22809d3ef0a27cb5c684e4aa068a42592f7723c7ebd8
4
+ data.tar.gz: 5f1b6adc6bd424e4ef1c872432d11c6d93ea5c18fe1cc25dd389deea7c1c3a5e
5
5
  SHA512:
6
- metadata.gz: 82e59acd421e1b32d0739167035ec770049ac0d27e1e5f00e7f3a9df5a01df00a7419be05443f9ae1ac45110eba1ad23fc0ccc73daf5c56388b2d1d867676d2e
7
- data.tar.gz: 96b3a5cefdde9a74e349111f33b7f33106e1587d3e1cbeef911a2cdafb0588d3ba43b0dd7cdb591c88256a4d151ecc44e076a0c87d009121cf200b62ee1f21da
6
+ metadata.gz: aca1b149e1727df52bf8ab922291cf9148e0c70867098674e11e5d4d092c278c800bf96017267c43763e1e3b009f998a87ecd4ee7800514d5087770ee33c65b2
7
+ data.tar.gz: 3f06f7c533c897094139c6d7ea90484314a1a3531fd64c56a9e615896599057ebb2c6165a138d17ba0f85089c10f0e68e259cd6c004e7466035f4bbd225e24ab
data/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.11.2] - 2026-07-15
9
+
10
+ ### Accessibility
11
+
12
+ - **Scrollable code blocks are keyboard-focusable.** Long lines make a `<pre>`
13
+ overflow horizontally via the host's CSS; a scrollable region that isn't
14
+ focusable strands keyboard-only users (WCAG 2.1.1; axe
15
+ `scrollable-region-focusable`). Every rendered code block now carries
16
+ `tabindex="0"`, mirroring the same fix already applied to wide tables in
17
+ 0.11.0. No `aria-label` is added — a `<pre>`'s own text is its accessible
18
+ name.
19
+
20
+ ## [0.11.1] - 2026-07-13
21
+
22
+ ### Accessibility (follow-up review)
23
+
24
+ - **Caption-less tables get a numbered, localized accessible name.** v0.11.0
25
+ labelled every un-captioned table the hardcoded English `"Table"`, so a
26
+ page of tables was undifferentiated to a screen reader and unlocalized.
27
+ They are now `"Table 1"`, `"Table 2"`, … via the new
28
+ `markdowndocs.table_label` I18n key (`"Table %{number}"`).
29
+
8
30
  ## [0.11.0] - 2026-07-13
9
31
 
10
32
  ### Accessibility
@@ -85,10 +85,26 @@ module Markdowndocs
85
85
  end
86
86
 
87
87
  mark_tables_keyboard_accessible(doc)
88
+ mark_code_blocks_keyboard_accessible(doc)
88
89
 
89
90
  doc.to_html
90
91
  end
91
92
 
93
+ # A code block (<pre>) overflows horizontally on long lines and becomes
94
+ # scrollable via the host's CSS, which the engine does not control and
95
+ # cannot inspect at render time — the same keyboard-access gap as wide
96
+ # tables (WCAG 2.1.1; axe `scrollable-region-focusable`). `tabindex="0"`
97
+ # makes each <pre> focusable so a keyboard-only user can scroll it with
98
+ # the arrow keys. Unlike a <table> we add NO aria-label: a <pre>'s own
99
+ # text content is its accessible name, so the focus stop is announced
100
+ # with the code itself; a synthetic "Code block N" label would only add
101
+ # noise. Same trade-off as tables — every code block becomes a tab stop,
102
+ # not only the ones that actually overflow, because scroll state is
103
+ # unknowable without a browser and this is a static (JS-free) fix.
104
+ def mark_code_blocks_keyboard_accessible(doc)
105
+ doc.css("pre").each { |pre| pre["tabindex"] = "0" }
106
+ end
107
+
92
108
  # A wide GFM table overflows its column and becomes horizontally
93
109
  # scrollable — via the host's typography/prose CSS, which the engine
94
110
  # does not control and cannot inspect at render time. A scrollable
@@ -109,9 +125,16 @@ module Markdowndocs
109
125
  # a static (JS-free) engine fix is worth that small amount of extra tab
110
126
  # travel.
111
127
  def mark_tables_keyboard_accessible(doc)
112
- doc.css("table").each do |table|
128
+ doc.css("table").each_with_index do |table, index|
113
129
  table["tabindex"] = "0"
114
- table["aria-label"] = "Table" unless table.at_css("caption") || table["aria-label"]
130
+ next if table.at_css("caption") || table["aria-label"]
131
+
132
+ # A caption-less table still needs an accessible name for its focus
133
+ # stop — but a page of identically-named "Table" regions is
134
+ # undifferentiated to a screen reader tabbing through. Number them,
135
+ # and route the label through I18n so non-English docs localize it.
136
+ table["aria-label"] = I18n.t("markdowndocs.table_label", number: index + 1,
137
+ default: "Table %{number}")
115
138
  end
116
139
  end
117
140
 
@@ -1,6 +1,7 @@
1
1
  en:
2
2
  markdowndocs:
3
3
  back_to_documentation: "Back to Documentation"
4
+ table_label: "Table %{number}"
4
5
  navigation_sidebar: "Navigation & Related Docs"
5
6
  viewing_mode: "Viewing Mode"
6
7
  select_viewing_mode: "Select documentation viewing mode"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markdowndocs
4
- VERSION = "0.11.0"
4
+ VERSION = "0.11.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdowndocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Chmura