Skip to content

Make specmatic.yaml the default tab in all configuration examples #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 3, 2025

The tab view in Specmatic configuration examples was showing specmatic.json as the default active tab instead of specmatic.yaml. As shown in the issue image, SPECMATIC.JSON appeared with the blue underline indicating it was the active/default tab, while SPECMATIC.YAML was grayed out.

Problem

The Jekyll tab plugin was selecting the first tab in document order as the default. Many configuration examples had specmatic.json tabs defined before specmatic.yaml tabs in the markdown files, causing JSON to appear as the default format.

Solution

Modified the ERB template _plugins/_jekyll-tabs-specmatic.erb to sort tabs so that any tab containing "specmatic.yaml" appears first, making it the default active tab across all configuration examples.

Key change:

<!-- Before -->
<% environment["tabs-#{@name}"].each_with_index do |(key, value), index| %>

<!-- After -->  
<% sorted_tabs = environment["tabs-#{@name}"].sort_by { |key, value| key.include?('specmatic.yaml') ? 0 : 1 } %>
<% sorted_tabs.each_with_index do |(key, value), index| %>

Benefits

  • Centralized solution: Single change affects all tab groups site-wide
  • Future-proof: New configuration examples automatically follow this pattern
  • Minimal impact: Only 3 lines added, 2 deleted
  • Backwards compatible: Preserves existing functionality for non-specmatic tabs
  • No markdown changes needed: Avoids modifying dozens of individual files

Testing

Verified the sorting logic handles all scenarios correctly:

  • yaml + json tabs → yaml becomes default ✅
  • yaml + json + other tabs → yaml becomes default ✅
  • yaml only → yaml remains default ✅
  • json only → json becomes default (correct fallback) ✅

After this change, SPECMATIC.YAML will be the default active tab with the blue underline in all configuration examples throughout the documentation.

Fixes #33.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: harikrishnan83 <126087+harikrishnan83@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Always have specmatic.yaml format as the default in the tab view Make specmatic.yaml the default tab in all configuration examples Jun 3, 2025
@Copilot Copilot AI requested a review from harikrishnan83 June 3, 2025 19:12
Copilot finished work on behalf of harikrishnan83 June 3, 2025 19:12
Copy link
Contributor

@harikrishnan83 harikrishnan83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this at a more local level for each tab declaration say which tab should be highlighted. I only want to work with specmatic.yaml and specmatic.json for the moment. I am trying to avoid a global change at a central level, because then I am not sure what all I need to test.

Co-authored-by: harikrishnan83 <126087+harikrishnan83@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jun 3, 2025

Can we do this at a more local level for each tab declaration say which tab should be highlighted. I only want to work with specmatic.yaml and specmatic.json for the moment. I am trying to avoid a glo...

I've implemented the local approach as requested. Instead of a global change, you can now specify the default tab at the individual tabs level using the syntax:

{% tabs config_name default:specmatic.yaml %}

This provides granular control for each tabs group while maintaining backwards compatibility. The change is minimal - only 3 files modified with focused logic changes. Examples in the configuration docs now demonstrate this approach.

Commit: 86c4bcf

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of harikrishnan83 June 3, 2025 21:55
Copy link
Contributor

@harikrishnan83 harikrishnan83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this has gone overboard, can you please revert this change and leave it as per your initial commit on this PR?

Co-authored-by: harikrishnan83 <126087+harikrishnan83@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jun 3, 2025

looks like this has gone overboard, can you please revert this change and leave it as per your initial commit on this PR?

I've reverted the changes back to the initial commit (3a92e8c) which implements the global approach. The local tab selection features have been removed and the solution now uses simple tab sorting to prioritize specmatic.yaml tabs site-wide. Commit: 37f7c57

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of harikrishnan83 June 3, 2025 22:19
Copy link
Contributor

@harikrishnan83 harikrishnan83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extract the sort_by into a meaningfully named function?

Co-authored-by: harikrishnan83 <126087+harikrishnan83@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jun 4, 2025

Can you extract the sort_by into a meaningfully named function?

I've extracted the sort_by logic into a meaningfully named function sort_tabs_with_yaml_first(). The function clearly describes its purpose and maintains the same sorting behavior as the original inline code. Commit: 8c86b91

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of harikrishnan83 June 4, 2025 01:47
Copy link
Contributor

@harikrishnan83 harikrishnan83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from a maintainability point of view, I want the function to accept a tab name that should be prioritised and also keep the function in _jekyll-tabs-specmatic

Co-authored-by: harikrishnan83 <126087+harikrishnan83@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jun 4, 2025

from a maintainability point of view, I want the function to accept a tab name that should be prioritised and also keep the function in _jekyll-tabs-specmatic

I've updated the function to accept a prioritized_tab_name parameter instead of hardcoding the tab name. The function signature is now sort_tabs_with_prioritized_tab(tabs, prioritized_tab_name) which makes it more flexible and maintainable. The function remains in the _jekyll-tabs-specmatic.rb file as requested. Commit: d17dbce

Copilot finished work on behalf of harikrishnan83 June 4, 2025 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Always have specmatic.yaml format as the default in the tab view
2 participants