From 191fccf4b5d228acbc0279b970fb3b5ab3471a1a Mon Sep 17 00:00:00 2001 From: garthdb Date: Thu, 12 Feb 2026 13:42:22 -0700 Subject: [PATCH 1/2] fix(s2-docs): fix YAML frontmatter syntax errors and improve validation - Add js-yaml dependency to actually parse YAML and catch syntax errors - Fix improperly indented field names (related_components, parent_category) - Fix escaped underscores in field names - Update validation to catch YAML parsing errors before other checks - Fixed 86 markdown files with YAML frontmatter issues --- docs/s2-docs/components/actions/action-bar.md | 2 +- .../components/actions/action-button.md | 4 +- .../components/actions/action-group.md | 4 +- .../components/actions/button-group.md | 4 +- docs/s2-docs/components/actions/button.md | 4 +- .../components/actions/close-button.md | 4 +- docs/s2-docs/components/actions/link.md | 4 +- docs/s2-docs/components/actions/list-view.md | 4 +- docs/s2-docs/components/actions/menu.md | 4 +- docs/s2-docs/components/containers/cards.md | 4 +- docs/s2-docs/components/containers/divider.md | 2 +- docs/s2-docs/components/containers/popover.md | 4 +- .../components/containers/standard-panel.md | 4 +- docs/s2-docs/components/containers/table.md | 4 +- .../components/feedback/alert-banner.md | 4 +- .../components/feedback/alert-dialog.md | 4 +- .../components/feedback/coach-indicator.md | 4 +- .../s2-docs/components/feedback/coach-mark.md | 4 +- .../components/feedback/contextual-help.md | 4 +- .../feedback/illustrated-message.md | 4 +- .../components/feedback/in-line-alert.md | 4 +- .../components/feedback/standard-dialog.md | 4 +- .../components/feedback/takeover-dialog.md | 4 +- docs/s2-docs/components/feedback/toast.md | 4 +- docs/s2-docs/components/feedback/tooltip.md | 4 +- docs/s2-docs/components/inputs/calendar.md | 4 +- .../components/inputs/checkbox-group.md | 4 +- docs/s2-docs/components/inputs/checkbox.md | 4 +- docs/s2-docs/components/inputs/color-area.md | 4 +- .../inputs/color-handle-and-loupe.md | 4 +- .../s2-docs/components/inputs/color-handle.md | 2 +- .../s2-docs/components/inputs/color-slider.md | 4 +- docs/s2-docs/components/inputs/color-wheel.md | 4 +- docs/s2-docs/components/inputs/combo-box.md | 4 +- docs/s2-docs/components/inputs/date-picker.md | 4 +- docs/s2-docs/components/inputs/drop-zone.md | 4 +- docs/s2-docs/components/inputs/field-label.md | 4 +- docs/s2-docs/components/inputs/help-text.md | 4 +- .../s2-docs/components/inputs/number-field.md | 4 +- docs/s2-docs/components/inputs/picker.md | 4 +- .../s2-docs/components/inputs/radio-button.md | 4 +- docs/s2-docs/components/inputs/radio-group.md | 4 +- docs/s2-docs/components/inputs/rating.md | 4 +- .../s2-docs/components/inputs/search-field.md | 4 +- .../components/inputs/segmented-control.md | 4 +- docs/s2-docs/components/inputs/select-box.md | 4 +- docs/s2-docs/components/inputs/slider.md | 4 +- .../s2-docs/components/inputs/swatch-group.md | 4 +- docs/s2-docs/components/inputs/swatch.md | 4 +- docs/s2-docs/components/inputs/switch.md | 4 +- docs/s2-docs/components/inputs/tag-field.md | 4 +- docs/s2-docs/components/inputs/tag-group.md | 4 +- docs/s2-docs/components/inputs/tag.md | 4 +- docs/s2-docs/components/inputs/text-area.md | 4 +- docs/s2-docs/components/inputs/text-field.md | 4 +- docs/s2-docs/components/inputs/thumbnail.md | 4 +- .../components/navigation/accordion.md | 4 +- .../components/navigation/breadcrumbs.md | 4 +- .../components/navigation/side-navigation.md | 4 +- docs/s2-docs/components/navigation/tabs.md | 4 +- .../components/navigation/tree-view.md | 4 +- .../s2-docs/components/status/avatar-group.md | 4 +- docs/s2-docs/components/status/avatar.md | 4 +- docs/s2-docs/components/status/badge.md | 4 +- docs/s2-docs/components/status/meter.md | 4 +- .../s2-docs/components/status/progress-bar.md | 4 +- .../components/status/progress-circle.md | 4 +- .../s2-docs/components/status/status-light.md | 4 +- docs/s2-docs/components/status/steplist.md | 4 +- .../designing/app-frame-content-area.md | 2 +- .../designing/app-frame-creating-bluelines.md | 2 +- docs/s2-docs/designing/app-frame-header.md | 2 +- docs/s2-docs/designing/app-frame-overview.md | 2 +- .../designing/app-frame-side-navigation.md | 2 +- docs/s2-docs/designing/background-layers.md | 2 +- docs/s2-docs/designing/colors.md | 2 +- docs/s2-docs/designing/containers.md | 2 +- docs/s2-docs/designing/grays.md | 2 +- docs/s2-docs/designing/illustrations.md | 2 +- docs/s2-docs/designing/object-styles.md | 2 +- .../designing/typography-fundamentals.md | 2 +- docs/s2-docs/designing/using-icons.md | 2 +- docs/s2-docs/developing/developer-overview.md | 2 +- docs/s2-docs/fundamentals/introduction.md | 2 +- docs/s2-docs/support/faqs.md | 2 +- docs/s2-docs/support/resources.md | 2 +- pnpm-lock.yaml | 3 + tools/s2-docs-transformer/package.json | 3 +- .../scripts/fix-yaml-frontmatter.js | 63 ++++++++++++++++++- .../test/yaml-frontmatter.test.js | 14 +++++ 90 files changed, 231 insertions(+), 156 deletions(-) diff --git a/docs/s2-docs/components/actions/action-bar.md b/docs/s2-docs/components/actions/action-bar.md index 1e72d55d..a8cf7993 100644 --- a/docs/s2-docs/components/actions/action-bar.md +++ b/docs/s2-docs/components/actions/action-bar.md @@ -8,7 +8,7 @@ status: published tags: - components-actions - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/action-button.md b/docs/s2-docs/components/actions/action-button.md index 5af9e6e3..9433bd80 100644 --- a/docs/s2-docs/components/actions/action-button.md +++ b/docs/s2-docs/components/actions/action-button.md @@ -11,10 +11,10 @@ tags: - action - button - interactive - related\_components: +related_components: - action-bar - action-group - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/action-group.md b/docs/s2-docs/components/actions/action-group.md index cc395ea2..150b0982 100644 --- a/docs/s2-docs/components/actions/action-group.md +++ b/docs/s2-docs/components/actions/action-group.md @@ -8,10 +8,10 @@ status: published tags: - components-actions - related\_components: +related_components: - action-button - button - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/button-group.md b/docs/s2-docs/components/actions/button-group.md index 4d0686da..9fc08948 100644 --- a/docs/s2-docs/components/actions/button-group.md +++ b/docs/s2-docs/components/actions/button-group.md @@ -11,10 +11,10 @@ tags: - action - button - interactive - related\_components: +related_components: - button - close-button - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/button.md b/docs/s2-docs/components/actions/button.md index 6320162b..47385260 100644 --- a/docs/s2-docs/components/actions/button.md +++ b/docs/s2-docs/components/actions/button.md @@ -11,12 +11,12 @@ tags: - action - button - interactive - related\_components: +related_components: - action-group - button-group - progress-bar - progress-circle - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/close-button.md b/docs/s2-docs/components/actions/close-button.md index 9f125309..61822d63 100644 --- a/docs/s2-docs/components/actions/close-button.md +++ b/docs/s2-docs/components/actions/close-button.md @@ -11,10 +11,10 @@ tags: - action - button - interactive - related\_components: +related_components: - button-group - link - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/link.md b/docs/s2-docs/components/actions/link.md index 2fff0eb7..233cb4e2 100644 --- a/docs/s2-docs/components/actions/link.md +++ b/docs/s2-docs/components/actions/link.md @@ -8,10 +8,10 @@ status: published tags: - components-actions - related\_components: +related_components: - close-button - list-view - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/list-view.md b/docs/s2-docs/components/actions/list-view.md index 61d90b2d..096c7ecc 100644 --- a/docs/s2-docs/components/actions/list-view.md +++ b/docs/s2-docs/components/actions/list-view.md @@ -8,10 +8,10 @@ status: published tags: - components-actions - related\_components: +related_components: - link - menu - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/actions/menu.md b/docs/s2-docs/components/actions/menu.md index 082309ba..7fe53904 100644 --- a/docs/s2-docs/components/actions/menu.md +++ b/docs/s2-docs/components/actions/menu.md @@ -11,10 +11,10 @@ tags: - navigation - menu - dropdown - related\_components: +related_components: - list-view - cards - parent\_category: actions +parent_category: actions --- diff --git a/docs/s2-docs/components/containers/cards.md b/docs/s2-docs/components/containers/cards.md index 2847481f..bbdf1a36 100644 --- a/docs/s2-docs/components/containers/cards.md +++ b/docs/s2-docs/components/containers/cards.md @@ -8,10 +8,10 @@ status: published tags: - components-containers - related\_components: +related_components: - menu - divider - parent\_category: containers +parent_category: containers --- diff --git a/docs/s2-docs/components/containers/divider.md b/docs/s2-docs/components/containers/divider.md index 440bc521..74299ad7 100644 --- a/docs/s2-docs/components/containers/divider.md +++ b/docs/s2-docs/components/containers/divider.md @@ -8,7 +8,7 @@ status: published tags: - components-containers - parent\_category: containers +parent_category: containers --- diff --git a/docs/s2-docs/components/containers/popover.md b/docs/s2-docs/components/containers/popover.md index f66818a3..b0f075ce 100644 --- a/docs/s2-docs/components/containers/popover.md +++ b/docs/s2-docs/components/containers/popover.md @@ -8,10 +8,10 @@ status: published tags: - components-containers - related\_components: +related_components: - divider - standard-panel - parent\_category: containers +parent_category: containers --- diff --git a/docs/s2-docs/components/containers/standard-panel.md b/docs/s2-docs/components/containers/standard-panel.md index 5f793e9b..872a17fb 100644 --- a/docs/s2-docs/components/containers/standard-panel.md +++ b/docs/s2-docs/components/containers/standard-panel.md @@ -8,10 +8,10 @@ status: published tags: - components-containers - related\_components: +related_components: - popover - table - parent\_category: containers +parent_category: containers --- diff --git a/docs/s2-docs/components/containers/table.md b/docs/s2-docs/components/containers/table.md index 1318800e..d34107ed 100644 --- a/docs/s2-docs/components/containers/table.md +++ b/docs/s2-docs/components/containers/table.md @@ -8,10 +8,10 @@ status: published tags: - components-containers - related\_components: +related_components: - standard-panel - alert-banner - parent\_category: containers +parent_category: containers --- diff --git a/docs/s2-docs/components/feedback/alert-banner.md b/docs/s2-docs/components/feedback/alert-banner.md index 5f376acb..30c17375 100644 --- a/docs/s2-docs/components/feedback/alert-banner.md +++ b/docs/s2-docs/components/feedback/alert-banner.md @@ -10,10 +10,10 @@ tags: - components-feedback - feedback - overlay - related\_components: +related_components: - table - alert-dialog - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/alert-dialog.md b/docs/s2-docs/components/feedback/alert-dialog.md index 7a7144c2..13ff6d14 100644 --- a/docs/s2-docs/components/feedback/alert-dialog.md +++ b/docs/s2-docs/components/feedback/alert-dialog.md @@ -10,10 +10,10 @@ tags: - components-feedback - feedback - overlay - related\_components: +related_components: - alert-banner - coach-indicator - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/coach-indicator.md b/docs/s2-docs/components/feedback/coach-indicator.md index c6e8d02d..473f2048 100644 --- a/docs/s2-docs/components/feedback/coach-indicator.md +++ b/docs/s2-docs/components/feedback/coach-indicator.md @@ -8,10 +8,10 @@ status: published tags: - components-feedback - related\_components: +related_components: - alert-dialog - coach-mark - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/coach-mark.md b/docs/s2-docs/components/feedback/coach-mark.md index 66ce096e..e27ebc68 100644 --- a/docs/s2-docs/components/feedback/coach-mark.md +++ b/docs/s2-docs/components/feedback/coach-mark.md @@ -8,10 +8,10 @@ status: published tags: - components-feedback - related\_components: +related_components: - coach-indicator - contextual-help - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/contextual-help.md b/docs/s2-docs/components/feedback/contextual-help.md index 7a2e0edf..25add177 100644 --- a/docs/s2-docs/components/feedback/contextual-help.md +++ b/docs/s2-docs/components/feedback/contextual-help.md @@ -8,10 +8,10 @@ status: published tags: - components-feedback - related\_components: +related_components: - coach-mark - illustrated-message - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/illustrated-message.md b/docs/s2-docs/components/feedback/illustrated-message.md index 924a54b2..633f1449 100644 --- a/docs/s2-docs/components/feedback/illustrated-message.md +++ b/docs/s2-docs/components/feedback/illustrated-message.md @@ -8,10 +8,10 @@ status: published tags: - components-feedback - related\_components: +related_components: - contextual-help - in-line-alert - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/in-line-alert.md b/docs/s2-docs/components/feedback/in-line-alert.md index 38ca2b9c..7d4632ad 100644 --- a/docs/s2-docs/components/feedback/in-line-alert.md +++ b/docs/s2-docs/components/feedback/in-line-alert.md @@ -10,10 +10,10 @@ tags: - components-feedback - feedback - overlay - related\_components: +related_components: - illustrated-message - standard-dialog - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/standard-dialog.md b/docs/s2-docs/components/feedback/standard-dialog.md index b7a8d3c1..07d86c82 100644 --- a/docs/s2-docs/components/feedback/standard-dialog.md +++ b/docs/s2-docs/components/feedback/standard-dialog.md @@ -10,10 +10,10 @@ tags: - components-feedback - feedback - overlay - related\_components: +related_components: - in-line-alert - takeover-dialog - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/takeover-dialog.md b/docs/s2-docs/components/feedback/takeover-dialog.md index a85baf88..8ca6debb 100644 --- a/docs/s2-docs/components/feedback/takeover-dialog.md +++ b/docs/s2-docs/components/feedback/takeover-dialog.md @@ -10,10 +10,10 @@ tags: - components-feedback - feedback - overlay - related\_components: +related_components: - standard-dialog - toast - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/toast.md b/docs/s2-docs/components/feedback/toast.md index bb552aa9..f5aa98a9 100644 --- a/docs/s2-docs/components/feedback/toast.md +++ b/docs/s2-docs/components/feedback/toast.md @@ -10,10 +10,10 @@ tags: - components-feedback - feedback - overlay - related\_components: +related_components: - takeover-dialog - tooltip - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/feedback/tooltip.md b/docs/s2-docs/components/feedback/tooltip.md index 628fa4e6..496e16b4 100644 --- a/docs/s2-docs/components/feedback/tooltip.md +++ b/docs/s2-docs/components/feedback/tooltip.md @@ -8,10 +8,10 @@ status: published tags: - components-feedback - related\_components: +related_components: - toast - calendar - parent\_category: feedback +parent_category: feedback --- diff --git a/docs/s2-docs/components/inputs/calendar.md b/docs/s2-docs/components/inputs/calendar.md index 6291b9d2..6095bb10 100644 --- a/docs/s2-docs/components/inputs/calendar.md +++ b/docs/s2-docs/components/inputs/calendar.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - tooltip - checkbox - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/checkbox-group.md b/docs/s2-docs/components/inputs/checkbox-group.md index 925b2161..7fd8d4a5 100644 --- a/docs/s2-docs/components/inputs/checkbox-group.md +++ b/docs/s2-docs/components/inputs/checkbox-group.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - checkbox - color-area - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/checkbox.md b/docs/s2-docs/components/inputs/checkbox.md index dea76613..28920ada 100644 --- a/docs/s2-docs/components/inputs/checkbox.md +++ b/docs/s2-docs/components/inputs/checkbox.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - calendar - checkbox-group - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/color-area.md b/docs/s2-docs/components/inputs/color-area.md index 4e7ae44f..ef501d85 100644 --- a/docs/s2-docs/components/inputs/color-area.md +++ b/docs/s2-docs/components/inputs/color-area.md @@ -10,10 +10,10 @@ tags: - components-inputs - design-tokens - color - related\_components: +related_components: - checkbox-group - color-handle - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/color-handle-and-loupe.md b/docs/s2-docs/components/inputs/color-handle-and-loupe.md index 200378b9..a1734a87 100644 --- a/docs/s2-docs/components/inputs/color-handle-and-loupe.md +++ b/docs/s2-docs/components/inputs/color-handle-and-loupe.md @@ -10,10 +10,10 @@ tags: - components-inputs - design-tokens - color - related\_components: +related_components: - color-area - color-slider - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/color-handle.md b/docs/s2-docs/components/inputs/color-handle.md index 2253a027..a1a0ab2c 100644 --- a/docs/s2-docs/components/inputs/color-handle.md +++ b/docs/s2-docs/components/inputs/color-handle.md @@ -11,7 +11,7 @@ tags: - input - color - color-picker - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/color-slider.md b/docs/s2-docs/components/inputs/color-slider.md index 0005c5ce..9b56e149 100644 --- a/docs/s2-docs/components/inputs/color-slider.md +++ b/docs/s2-docs/components/inputs/color-slider.md @@ -10,10 +10,10 @@ tags: - components-inputs - design-tokens - color - related\_components: +related_components: - color-handle - color-wheel - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/color-wheel.md b/docs/s2-docs/components/inputs/color-wheel.md index a06feaec..2a02d10b 100644 --- a/docs/s2-docs/components/inputs/color-wheel.md +++ b/docs/s2-docs/components/inputs/color-wheel.md @@ -10,10 +10,10 @@ tags: - components-inputs - design-tokens - color - related\_components: +related_components: - color-slider - combo-box - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/combo-box.md b/docs/s2-docs/components/inputs/combo-box.md index e81b0ae9..1aa5a031 100644 --- a/docs/s2-docs/components/inputs/combo-box.md +++ b/docs/s2-docs/components/inputs/combo-box.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - color-wheel - date-picker - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/date-picker.md b/docs/s2-docs/components/inputs/date-picker.md index d8cac896..2109ed27 100644 --- a/docs/s2-docs/components/inputs/date-picker.md +++ b/docs/s2-docs/components/inputs/date-picker.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - combo-box - drop-zone - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/drop-zone.md b/docs/s2-docs/components/inputs/drop-zone.md index 52d95724..5efb4fbb 100644 --- a/docs/s2-docs/components/inputs/drop-zone.md +++ b/docs/s2-docs/components/inputs/drop-zone.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - date-picker - field-label - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/field-label.md b/docs/s2-docs/components/inputs/field-label.md index 29c9daf9..ca201295 100644 --- a/docs/s2-docs/components/inputs/field-label.md +++ b/docs/s2-docs/components/inputs/field-label.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - drop-zone - help-text - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/help-text.md b/docs/s2-docs/components/inputs/help-text.md index 554b9b94..15c999e7 100644 --- a/docs/s2-docs/components/inputs/help-text.md +++ b/docs/s2-docs/components/inputs/help-text.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - field-label - number-field - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/number-field.md b/docs/s2-docs/components/inputs/number-field.md index 53686cb3..eeb464f1 100644 --- a/docs/s2-docs/components/inputs/number-field.md +++ b/docs/s2-docs/components/inputs/number-field.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - help-text - picker - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/picker.md b/docs/s2-docs/components/inputs/picker.md index abfaf836..c6b2cb2e 100644 --- a/docs/s2-docs/components/inputs/picker.md +++ b/docs/s2-docs/components/inputs/picker.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - number-field - radio-button - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/radio-button.md b/docs/s2-docs/components/inputs/radio-button.md index 955ebc39..2bf973cf 100644 --- a/docs/s2-docs/components/inputs/radio-button.md +++ b/docs/s2-docs/components/inputs/radio-button.md @@ -11,10 +11,10 @@ tags: - action - button - interactive - related\_components: +related_components: - picker - radio-group - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/radio-group.md b/docs/s2-docs/components/inputs/radio-group.md index 55597c2c..3ecd50ca 100644 --- a/docs/s2-docs/components/inputs/radio-group.md +++ b/docs/s2-docs/components/inputs/radio-group.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - radio-button - rating - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/rating.md b/docs/s2-docs/components/inputs/rating.md index 085b33ca..46b06985 100644 --- a/docs/s2-docs/components/inputs/rating.md +++ b/docs/s2-docs/components/inputs/rating.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - radio-group - search-field - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/search-field.md b/docs/s2-docs/components/inputs/search-field.md index dfcbcea5..b1b755d6 100644 --- a/docs/s2-docs/components/inputs/search-field.md +++ b/docs/s2-docs/components/inputs/search-field.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - rating - segmented-control - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/segmented-control.md b/docs/s2-docs/components/inputs/segmented-control.md index 3384caf4..216f2ed1 100644 --- a/docs/s2-docs/components/inputs/segmented-control.md +++ b/docs/s2-docs/components/inputs/segmented-control.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - search-field - select-box - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/select-box.md b/docs/s2-docs/components/inputs/select-box.md index 98eb929f..e0081d03 100644 --- a/docs/s2-docs/components/inputs/select-box.md +++ b/docs/s2-docs/components/inputs/select-box.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - segmented-control - slider - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/slider.md b/docs/s2-docs/components/inputs/slider.md index 2b625895..9c47cda4 100644 --- a/docs/s2-docs/components/inputs/slider.md +++ b/docs/s2-docs/components/inputs/slider.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - select-box - swatch - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/swatch-group.md b/docs/s2-docs/components/inputs/swatch-group.md index ba27c8eb..2e969a2c 100644 --- a/docs/s2-docs/components/inputs/swatch-group.md +++ b/docs/s2-docs/components/inputs/swatch-group.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - swatch - switch - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/swatch.md b/docs/s2-docs/components/inputs/swatch.md index 5c9768e8..f8d397d0 100644 --- a/docs/s2-docs/components/inputs/swatch.md +++ b/docs/s2-docs/components/inputs/swatch.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - slider - swatch-group - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/switch.md b/docs/s2-docs/components/inputs/switch.md index 3aa191c5..401ae238 100644 --- a/docs/s2-docs/components/inputs/switch.md +++ b/docs/s2-docs/components/inputs/switch.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - swatch-group - tag - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/tag-field.md b/docs/s2-docs/components/inputs/tag-field.md index e3c74ae2..3e2324b7 100644 --- a/docs/s2-docs/components/inputs/tag-field.md +++ b/docs/s2-docs/components/inputs/tag-field.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - tag - tag-group - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/tag-group.md b/docs/s2-docs/components/inputs/tag-group.md index 650aac5e..dd4614a1 100644 --- a/docs/s2-docs/components/inputs/tag-group.md +++ b/docs/s2-docs/components/inputs/tag-group.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - tag-field - text-area - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/tag.md b/docs/s2-docs/components/inputs/tag.md index af93d5a6..60085b0c 100644 --- a/docs/s2-docs/components/inputs/tag.md +++ b/docs/s2-docs/components/inputs/tag.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - switch - tag-field - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/text-area.md b/docs/s2-docs/components/inputs/text-area.md index 12ef8636..59b8ed80 100644 --- a/docs/s2-docs/components/inputs/text-area.md +++ b/docs/s2-docs/components/inputs/text-area.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - tag-group - text-field - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/text-field.md b/docs/s2-docs/components/inputs/text-field.md index fe2f704c..8ae86bf5 100644 --- a/docs/s2-docs/components/inputs/text-field.md +++ b/docs/s2-docs/components/inputs/text-field.md @@ -10,10 +10,10 @@ tags: - components-inputs - input - form - related\_components: +related_components: - text-area - thumbnail - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/inputs/thumbnail.md b/docs/s2-docs/components/inputs/thumbnail.md index de26806a..bc550253 100644 --- a/docs/s2-docs/components/inputs/thumbnail.md +++ b/docs/s2-docs/components/inputs/thumbnail.md @@ -8,10 +8,10 @@ status: published tags: - components-inputs - related\_components: +related_components: - text-field - accordion - parent\_category: inputs +parent_category: inputs --- diff --git a/docs/s2-docs/components/navigation/accordion.md b/docs/s2-docs/components/navigation/accordion.md index 6ebae133..5890e3e8 100644 --- a/docs/s2-docs/components/navigation/accordion.md +++ b/docs/s2-docs/components/navigation/accordion.md @@ -8,10 +8,10 @@ status: published tags: - components-navigation - related\_components: +related_components: - thumbnail - breadcrumbs - parent\_category: navigation +parent_category: navigation --- diff --git a/docs/s2-docs/components/navigation/breadcrumbs.md b/docs/s2-docs/components/navigation/breadcrumbs.md index 2118e58a..39637b50 100644 --- a/docs/s2-docs/components/navigation/breadcrumbs.md +++ b/docs/s2-docs/components/navigation/breadcrumbs.md @@ -8,10 +8,10 @@ status: published tags: - components-navigation - related\_components: +related_components: - accordion - side-navigation - parent\_category: navigation +parent_category: navigation --- diff --git a/docs/s2-docs/components/navigation/side-navigation.md b/docs/s2-docs/components/navigation/side-navigation.md index ab7ab223..5e5d3fc6 100644 --- a/docs/s2-docs/components/navigation/side-navigation.md +++ b/docs/s2-docs/components/navigation/side-navigation.md @@ -8,10 +8,10 @@ status: published tags: - components-navigation - related\_components: +related_components: - breadcrumbs - tabs - parent\_category: navigation +parent_category: navigation --- diff --git a/docs/s2-docs/components/navigation/tabs.md b/docs/s2-docs/components/navigation/tabs.md index cad579f5..5b5fca86 100644 --- a/docs/s2-docs/components/navigation/tabs.md +++ b/docs/s2-docs/components/navigation/tabs.md @@ -8,10 +8,10 @@ status: published tags: - components-navigation - related\_components: +related_components: - side-navigation - tree-view - parent\_category: navigation +parent_category: navigation --- diff --git a/docs/s2-docs/components/navigation/tree-view.md b/docs/s2-docs/components/navigation/tree-view.md index ec33ca5e..68a2bb1a 100644 --- a/docs/s2-docs/components/navigation/tree-view.md +++ b/docs/s2-docs/components/navigation/tree-view.md @@ -8,10 +8,10 @@ status: published tags: - components-navigation - related\_components: +related_components: - tabs - avatar - parent\_category: navigation +parent_category: navigation --- diff --git a/docs/s2-docs/components/status/avatar-group.md b/docs/s2-docs/components/status/avatar-group.md index 36a24f98..49fe54ff 100644 --- a/docs/s2-docs/components/status/avatar-group.md +++ b/docs/s2-docs/components/status/avatar-group.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - avatar - badge - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/avatar.md b/docs/s2-docs/components/status/avatar.md index dfddc271..4062357d 100644 --- a/docs/s2-docs/components/status/avatar.md +++ b/docs/s2-docs/components/status/avatar.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - tree-view - avatar-group - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/badge.md b/docs/s2-docs/components/status/badge.md index 786dd4d5..080a741f 100644 --- a/docs/s2-docs/components/status/badge.md +++ b/docs/s2-docs/components/status/badge.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - avatar-group - meter - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/meter.md b/docs/s2-docs/components/status/meter.md index 76af66fb..4176fa31 100644 --- a/docs/s2-docs/components/status/meter.md +++ b/docs/s2-docs/components/status/meter.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - badge - progress-bar - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/progress-bar.md b/docs/s2-docs/components/status/progress-bar.md index c8336827..0c02f67c 100644 --- a/docs/s2-docs/components/status/progress-bar.md +++ b/docs/s2-docs/components/status/progress-bar.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - meter - progress-circle - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/progress-circle.md b/docs/s2-docs/components/status/progress-circle.md index 131625b6..2e3ba1bb 100644 --- a/docs/s2-docs/components/status/progress-circle.md +++ b/docs/s2-docs/components/status/progress-circle.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - progress-bar - status-light - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/status-light.md b/docs/s2-docs/components/status/status-light.md index c1f322fb..190dd917 100644 --- a/docs/s2-docs/components/status/status-light.md +++ b/docs/s2-docs/components/status/status-light.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - progress-circle - steplist - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/components/status/steplist.md b/docs/s2-docs/components/status/steplist.md index fdaac3ed..93006d84 100644 --- a/docs/s2-docs/components/status/steplist.md +++ b/docs/s2-docs/components/status/steplist.md @@ -8,10 +8,10 @@ status: published tags: - components-status - related\_components: +related_components: - status-light - faqs - parent\_category: status +parent_category: status --- diff --git a/docs/s2-docs/designing/app-frame-content-area.md b/docs/s2-docs/designing/app-frame-content-area.md index b3288613..014433af 100644 --- a/docs/s2-docs/designing/app-frame-content-area.md +++ b/docs/s2-docs/designing/app-frame-content-area.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - s2-app-frame-side-navigation-browsing-context - s2-app-frame-creating-bluelines-browsing-context diff --git a/docs/s2-docs/designing/app-frame-creating-bluelines.md b/docs/s2-docs/designing/app-frame-creating-bluelines.md index 547d7e56..49ae5e4a 100644 --- a/docs/s2-docs/designing/app-frame-creating-bluelines.md +++ b/docs/s2-docs/designing/app-frame-creating-bluelines.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - s2-app-frame-content-area-browsing-context - brand diff --git a/docs/s2-docs/designing/app-frame-header.md b/docs/s2-docs/designing/app-frame-header.md index 43831a62..6882f45a 100644 --- a/docs/s2-docs/designing/app-frame-header.md +++ b/docs/s2-docs/designing/app-frame-header.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - s2-app-frame - s2-app-frame-side-navigation-browsing-context diff --git a/docs/s2-docs/designing/app-frame-overview.md b/docs/s2-docs/designing/app-frame-overview.md index 1ae93dcb..7277b9f4 100644 --- a/docs/s2-docs/designing/app-frame-overview.md +++ b/docs/s2-docs/designing/app-frame-overview.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - containers - s2-app-frame-header-browsing-context diff --git a/docs/s2-docs/designing/app-frame-side-navigation.md b/docs/s2-docs/designing/app-frame-side-navigation.md index a4e877b2..541b6ab1 100644 --- a/docs/s2-docs/designing/app-frame-side-navigation.md +++ b/docs/s2-docs/designing/app-frame-side-navigation.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - s2-app-frame-header-browsing-context - s2-app-frame-content-area-browsing-context diff --git a/docs/s2-docs/designing/background-layers.md b/docs/s2-docs/designing/background-layers.md index e1c9bd7c..69eacc9e 100644 --- a/docs/s2-docs/designing/background-layers.md +++ b/docs/s2-docs/designing/background-layers.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - colors - typography-fundamentals diff --git a/docs/s2-docs/designing/colors.md b/docs/s2-docs/designing/colors.md index a16f25b7..c040d37c 100644 --- a/docs/s2-docs/designing/colors.md +++ b/docs/s2-docs/designing/colors.md @@ -9,7 +9,7 @@ tags: - designing - design-tokens - color - related\_components: +related_components: - grays - background-layers diff --git a/docs/s2-docs/designing/containers.md b/docs/s2-docs/designing/containers.md index 5d986c21..33045592 100644 --- a/docs/s2-docs/designing/containers.md +++ b/docs/s2-docs/designing/containers.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - states - s2-app-frame diff --git a/docs/s2-docs/designing/grays.md b/docs/s2-docs/designing/grays.md index 8df5d8bf..d2fe3341 100644 --- a/docs/s2-docs/designing/grays.md +++ b/docs/s2-docs/designing/grays.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - attention-hierarchy - colors diff --git a/docs/s2-docs/designing/illustrations.md b/docs/s2-docs/designing/illustrations.md index d22e0152..7caaf08c 100644 --- a/docs/s2-docs/designing/illustrations.md +++ b/docs/s2-docs/designing/illustrations.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - using-icons - motion diff --git a/docs/s2-docs/designing/object-styles.md b/docs/s2-docs/designing/object-styles.md index b0e20dfa..f025d2fe 100644 --- a/docs/s2-docs/designing/object-styles.md +++ b/docs/s2-docs/designing/object-styles.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - fonts - spacing diff --git a/docs/s2-docs/designing/typography-fundamentals.md b/docs/s2-docs/designing/typography-fundamentals.md index 43d77877..85aba1c8 100644 --- a/docs/s2-docs/designing/typography-fundamentals.md +++ b/docs/s2-docs/designing/typography-fundamentals.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - background-layers - fonts diff --git a/docs/s2-docs/designing/using-icons.md b/docs/s2-docs/designing/using-icons.md index de0a1e16..f6bc2a33 100644 --- a/docs/s2-docs/designing/using-icons.md +++ b/docs/s2-docs/designing/using-icons.md @@ -7,7 +7,7 @@ status: published tags: - designing - related\_components: +related_components: - icon-fundamentals - illustrations diff --git a/docs/s2-docs/developing/developer-overview.md b/docs/s2-docs/developing/developer-overview.md index 77900c65..20ceefd1 100644 --- a/docs/s2-docs/developing/developer-overview.md +++ b/docs/s2-docs/developing/developer-overview.md @@ -7,7 +7,7 @@ status: published tags: - developing - related\_components: +related_components: - motion - action-bar diff --git a/docs/s2-docs/fundamentals/introduction.md b/docs/s2-docs/fundamentals/introduction.md index 27d62218..3535fe48 100644 --- a/docs/s2-docs/fundamentals/introduction.md +++ b/docs/s2-docs/fundamentals/introduction.md @@ -7,7 +7,7 @@ status: published tags: - fundamentals - related\_components: +related_components: - home - principles diff --git a/docs/s2-docs/support/faqs.md b/docs/s2-docs/support/faqs.md index 27872266..319910c5 100644 --- a/docs/s2-docs/support/faqs.md +++ b/docs/s2-docs/support/faqs.md @@ -7,7 +7,7 @@ status: published tags: - support - related\_components: +related_components: - steplist - contact diff --git a/docs/s2-docs/support/resources.md b/docs/s2-docs/support/resources.md index 55ab5b8c..36f966b4 100644 --- a/docs/s2-docs/support/resources.md +++ b/docs/s2-docs/support/resources.md @@ -7,7 +7,7 @@ status: published tags: - support - related\_components: +related_components: - contact --- diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 030d6ad4..74dd785b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -619,6 +619,9 @@ importers: "@modelcontextprotocol/sdk": specifier: ^1.0.4 version: 1.26.0(zod@3.25.76) + js-yaml: + specifier: ^4.1.1 + version: 4.1.1 tools/spectrum-design-data-mcp: dependencies: diff --git a/tools/s2-docs-transformer/package.json b/tools/s2-docs-transformer/package.json index c3fcad36..b3923f0a 100644 --- a/tools/s2-docs-transformer/package.json +++ b/tools/s2-docs-transformer/package.json @@ -18,7 +18,8 @@ "process-all": "npm run transform && npm run add-metadata" }, "dependencies": { - "@modelcontextprotocol/sdk": "^1.0.4" + "@modelcontextprotocol/sdk": "^1.0.4", + "js-yaml": "^4.1.1" }, "keywords": [ "spectrum", diff --git a/tools/s2-docs-transformer/scripts/fix-yaml-frontmatter.js b/tools/s2-docs-transformer/scripts/fix-yaml-frontmatter.js index 9a53697d..2661fa73 100644 --- a/tools/s2-docs-transformer/scripts/fix-yaml-frontmatter.js +++ b/tools/s2-docs-transformer/scripts/fix-yaml-frontmatter.js @@ -17,12 +17,14 @@ * 2. Remove escaped underscores (\\_) from field names * 3. Remove angle brackets from URLs * 4. Clean up excessive blank lines + * 5. Fix improperly indented field names in list contexts */ import { readFileSync, writeFileSync, readdirSync } from "fs"; import { join } from "path"; import { fileURLToPath } from "url"; import { dirname } from "path"; +import yaml from "js-yaml"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -73,10 +75,13 @@ function fixFrontmatter(content) { } // Fix 2: Replace escaped underscores in field names - // Match patterns like "source\_url:" or "last\_updated:" - const escapedUnderscoreRegex = /^(\w+)\\_(\w+):/gm; + // Match patterns like "source\_url:" or "last\_updated:" or "related\_components:" + const escapedUnderscoreRegex = /^([\w\\]+)\\_/gm; if (escapedUnderscoreRegex.test(fixed)) { - fixed = fixed.replace(escapedUnderscoreRegex, "$1_$2:"); + fixed = fixed.replace(escapedUnderscoreRegex, (match, prefix) => { + // Remove all backslashes from the prefix and replace \_ with _ + return prefix.replace(/\\/g, "") + "_"; + }); changed = true; } @@ -115,6 +120,58 @@ function fixFrontmatter(content) { changed = true; } + // Fix 7: Fix improperly indented field names (fields that look like they're part of a list) + // This catches patterns like: + // - item + // field_name: + // And converts them to: + // - item + // field_name: + const linesArray = fixed.split("\n"); + const fixedLinesArray = []; + + for (let i = 0; i < linesArray.length; i++) { + const line = linesArray[i]; + + // Check if this line is an improperly indented field (starts with spaces and has a colon) + // Need to handle escaped underscores like related\_components + const fieldMatch = line.match(/^(\s+)([\w\\]+):/); + + if (fieldMatch && i > 0) { + const [, fieldIndent, fieldName] = fieldMatch; + + // Look back to find the last list item or field definition + let lastIndent = 0; + for (let j = i - 1; j >= 0; j--) { + const prevLine = linesArray[j]; + const listMatch = prevLine.match(/^(\s*)-\s+/); + const prevFieldMatch = prevLine.match(/^(\s*)([\w\\]+):/); + + if (listMatch) { + lastIndent = listMatch[1].length; + break; + } else if (prevFieldMatch) { + lastIndent = prevFieldMatch[1].length; + break; + } + } + + // If this field is indented more than it should be (more than the list item indent) + if (fieldIndent.length > lastIndent) { + changed = true; + // Fix the indentation + const restOfLine = line.slice(fieldMatch[0].length); + const fixedLine = " ".repeat(lastIndent) + fieldName + ":" + restOfLine; + fixedLinesArray.push(fixedLine); + continue; + } + } + + fixedLinesArray.push(line); + } + + fixed = fixedLinesArray.join("\n"); + if (!changed) { return { content, changed: false }; } diff --git a/tools/s2-docs-transformer/test/yaml-frontmatter.test.js b/tools/s2-docs-transformer/test/yaml-frontmatter.test.js index 5c48cd25..ba786cfa 100644 --- a/tools/s2-docs-transformer/test/yaml-frontmatter.test.js +++ b/tools/s2-docs-transformer/test/yaml-frontmatter.test.js @@ -14,6 +14,7 @@ import test from "ava"; import { readFileSync, readdirSync, statSync } from "fs"; import { join, dirname } from "path"; import { fileURLToPath } from "url"; +import yaml from "js-yaml"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -55,6 +56,19 @@ function extractFrontmatter(content) { function validateYamlFrontmatter(frontmatter, filePath) { const errors = []; + // First, try to parse the YAML to catch syntax errors + try { + yaml.load(frontmatter); + } catch (error) { + errors.push({ + type: "yaml-syntax-error", + message: `YAML parsing failed: ${error.message}`, + error: error.message, + }); + // If YAML parsing fails, return early since other checks won't be meaningful + return errors; + } + // Check for asterisk list items (YAML interprets * as alias references) if (/^\*/m.test(frontmatter)) { errors.push({ From 9bab3e23f48427940fe911b88183dad081950c57 Mon Sep 17 00:00:00 2001 From: garthdb Date: Thu, 12 Feb 2026 14:29:25 -0700 Subject: [PATCH 2/2] feat(docs): add workflow to publish s2-docs markdown to orphan branch Add GitHub Actions workflow to publish docs/s2-docs markdown files to a docs-markdown orphan branch for chatbot indexing. This is Phase 1 of publishing markdown content - Phase 2 will add markdown-generator output alongside s2-docs content in PR #696. --- .github/workflows/publish-markdown.yml | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/publish-markdown.yml diff --git a/.github/workflows/publish-markdown.yml b/.github/workflows/publish-markdown.yml new file mode 100644 index 00000000..a3888fd4 --- /dev/null +++ b/.github/workflows/publish-markdown.yml @@ -0,0 +1,59 @@ +name: Publish Markdown + +on: + push: + branches: [main] + paths: + - "docs/s2-docs/**" + workflow_run: + workflows: ["Release"] + types: [completed] + branches: [main] + workflow_dispatch: + +permissions: + contents: write + +jobs: + publish: + runs-on: ubuntu-latest + if: >- + github.event_name != 'workflow_run' + || github.event.workflow_run.conclusion == 'success' + steps: + - uses: actions/checkout@v4 + + - name: Publish to docs-markdown branch + run: | + BRANCH="docs-markdown" + + # Stage s2-docs markdown (only .md files, preserve dir structure) + mkdir -p /tmp/s2-docs + cd docs/s2-docs + find . -name '*.md' | while read f; do + mkdir -p "/tmp/s2-docs/$(dirname "$f")" + cp "$f" "/tmp/s2-docs/$f" + done + cd "$GITHUB_WORKSPACE" + + # Switch to orphan branch + git fetch origin "$BRANCH" 2>/dev/null || true + if git show-ref --verify --quiet refs/remotes/origin/"$BRANCH"; then + git checkout "$BRANCH" + else + git checkout --orphan "$BRANCH" + fi + git rm -rf . 2>/dev/null || true + + # Copy s2-docs markdown + cp -r /tmp/s2-docs s2-docs + + git add s2-docs + if git diff --staged --quiet; then + echo "No changes to commit" + else + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git commit -m "chore(docs): update s2-docs markdown for chatbot indexing" + git push -f origin "$BRANCH" + fi