sphinx-inline-tabs icon indicating copy to clipboard operation
sphinx-inline-tabs copied to clipboard

Make it possible to override the synchronisation ID

Open kjelljorner opened this issue 4 years ago • 6 comments

Synchronization is obviously great for many purposes, but sometimes this is not something that you want. Take this example where I want to give input and (long) output in separate tabs. At the moment, the only way to prevent all tabs from switching is to rename the tab (Input 1, Input 2 etc.), which also changes its caption. I think a better way to do this would be to separate the caption from the name/label. image

kjelljorner avatar Apr 19 '21 14:04 kjelljorner

I also have a use-case which requires disabling synchronization. Its a very nice feature but sometimes the complete opposite of what you want.

aantn avatar Nov 01 '21 07:11 aantn

Agreed, I'm having issues with not being able to turn off synchronization where it is not necessary, as changing tabs which are meant to be swapped back and forth causes the entire page to shift up/down when many synchronized tabs exist.

astrsh avatar Dec 24 '21 07:12 astrsh

I switched to sphinx-design because of this. I still love this extension though 😍

On Fri, 24 Dec 2021, 9:56 Astrashh, @.***> wrote:

Agreed, I'm having issues with not being able to turn off synchronization where it is not necessary, as changing tabs which are meant to be swapped back and forth causes the entire page to shift up/down when many synchronized tabs exist.

— Reply to this email directly, view it on GitHub https://github.com/pradyunsg/sphinx-inline-tabs/issues/18#issuecomment-1000708940, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYUB3RYTMLQKSAQ46L6VLUSQRUVANCNFSM43F6JKLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

aantn avatar Dec 24 '21 09:12 aantn

In case this is useful to anyone else, I completely turned off synchronization for my project by adding the following to conf.py:

from pathlib import Path

def remove_tabs_js(app, exc):
    if app.builder.format == 'html' and not exc:
        tabs_js = Path(app.builder.outdir) / '_static' / 'tabs.js'
        tabs_js.unlink()

def setup(app):
    app.connect('build-finished', remove_tabs_js)

kalekundert avatar Feb 14 '22 16:02 kalekundert

FWIW, I'm on board for this idea and would appreciate a PR to add this!

The design I have in mind is:

  • A :sync: str on tab directive, allowing authors to override behaviours. Error out on multiple tabs having the same sync key within a single tabset (ideally, with file + line number).
  • A :no-sync: on .. tab directive, to opt-out on specific tabs.
  • tabs_default_sync_behavior configuration option to configure the default behaviour with the initial supported values being "tab-title" (default) and "none". Error out on all other values.

pradyunsg avatar Jul 09 '23 11:07 pradyunsg