Commit 20d4d9a
committed
fix: TOC double-entry + missing-section bugs after markdown-strip changes
Two bugs from the same root cause: hideSectionSlugs strips sections from
the rendered HTML body but DocumentToc reads its markdown items from the
precompiled siteData.documentIndex[path].toc list, which still contains
the stripped headings. Result on the user side:
1. 'Двойная кнопка Mitigation одна пустая' — TOC shows the original
markdown 'Mitigations' heading (anchor target removed from body, so
click goes nowhere) PLUS the JSX extraItem 'Mitigations (7)'. Two
identical-looking entries, one broken.
2. 'Секция Mitigation исчезла' on Techniques where relatedMitigations.length
was 0 — the JSX cards section was guarded with > 0 (correct) but the
markdown-side strip ran unconditionally, hiding the markdown body's
own '## Mitigations' prose. User saw neither cards nor prose.
Fixes:
DocumentToc — accepts the same hideSectionSlugs prop. Markdown items
filtered through the slug set before rendering; the TOC stays in
sync with what's actually rendered in the body.
TechniqueDetailPage / GroupDetailPage — hiddenSlugs is now computed
conditionally:
if (relatedMitigations.length > 0) hiddenSlugs.push('mitigations');
if (relatedExamples.length > 0) hiddenSlugs.push('real-world-examples');
(Group: 'observed-techniques' / 'observed-examples' on equivalent
counts.)
Same hiddenSlugs passed both to InlineMarkdown (body strip) and to
DocumentToc (TOC strip) so they can never disagree.
Group page also now exposes Observed Techniques + Worked Examples
extraItems to TOC (was missing — only Software used was wired).
Build clean. Should resolve both 'двойная кнопка' and 'секция исчезла'.1 parent 920cf4a commit 20d4d9a
3 files changed
Lines changed: 36 additions & 11 deletions
File tree
- src/components
- detail-pages
- document
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| |||
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| 75 | + | |
70 | 76 | | |
71 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| |||
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
98 | | - | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
143 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
144 | 153 | | |
145 | 154 | | |
146 | 155 | | |
147 | 156 | | |
148 | | - | |
| 157 | + | |
149 | 158 | | |
150 | 159 | | |
151 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
| |||
0 commit comments