Skip to content

Adding the "tabs" directive #161

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

Merged
merged 1 commit into from
Jul 11, 2023
Merged

Conversation

weaverryan
Copy link
Contributor

Hi!

This adds a "tabs" directive, based off of https://sphinx-tabs.readthedocs.io/en/latest/

Example:

.. tabs:: UX Installation

    .. tab:: Webpack Encore

        Webpack Encore stuff!

        .. code-block:: yaml

            I am yaml:

    .. tab:: AssetMapper

        AssetMapper stuff!

        And another paragraph.

This will render (with a little assistance from Javier) just like a "configuration block", except that you can put any content inside. My use-case is for some UX-related items where install steps will now be different if you're using Encore vs AssetMapper, and I think a tabbed setup will be better than 2 sections right after each other.

Feedback appreciated!

@javiereguiluz
Copy link
Collaborator

@weaverryan thanks for this! I've tested this in my local machine and didn't fully work. The missing part is the data-language attribute for each tab with the same content as the tab title ("Webpack Encore" and "AssetMapper" in this case).

I know that these tabs won't always be used for "programming languages" ... but this is just an internal detail in the generated HTML, so I think it's OK to do it without renaming the data-language attribute. Thanks!

@weaverryan
Copy link
Contributor Author

Thank you for trying it out @javiereguiluz!

I've updated to re-add the data-language - it's a "slugged" version of what appears on the tab, which I think will work: the current configuration block also uses a slightly different string in the data-language vs what appears in the tab.

I'm also now just reusing the configuration-block.html.twig template: it is effectively now the "generic tab template". Let me know if this work.

Cheers!

@javiereguiluz
Copy link
Collaborator

Thanks for the updates! I copied the HTML code of tests/fixtures/expected/blocks/directives/tabs.html in a random Symfony Docs page and it worked:

tabs

About the value of data-language, it can be anything as long as it's different from the other tabs and it's consistent (all tabs of the same type use the same value).

So, this should be ready! Cheers!

@weaverryan
Copy link
Contributor Author

Yaaaaaay! That looks like I expected. Thank you!!!

@weaverryan
Copy link
Contributor Author

@javiereguiluz Is this ready to merge? I was going to allow you to do it, as I assume you'll be the one integrating this into symfony.com.

Thanks!

@javiereguiluz
Copy link
Collaborator

Ryan, I'm really sorry! I totally forgot about this 😞 I'm merging this, tagging a new release and then updating symfony.com server to use the new version. Thanks!

@javiereguiluz javiereguiluz merged commit 7ab92db into symfony-tools:main Jul 11, 2023
@javiereguiluz
Copy link
Collaborator

javiereguiluz commented Jul 11, 2023

@weaverryan this is now deployed on symfony.com, so we can already use the new directive in docs. Thanks!

@weaverryan weaverryan deleted the tabs branch July 11, 2023 16:24
@weaverryan
Copy link
Contributor Author

thank you!!!

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jul 17, 2023
This PR was merged into the 5.4 branch.

Discussion
----------

[Format] Add `tabs` directive

I think it is worth mentioning `@weaverryan`'s tabs added here: symfony-tools/docs-builder#161 🙂

Commits
-------

b61cb59 [Format] Add `tabs` directive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants