Skip to content
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

Add a new-tabbed variant for the Replite directive, and allow customisation of its button text #228

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

agriyakhetarpal
Copy link
Member

Description

This continues #165, #223, and #227 for the Replite directive. We do not subclass from the BaseNotebookTab class here since we need to construct a URL with quoted code that has been passed to the directive (similar to the TryExamples directive).

I was initially unsure about doing this as I mentioned in #227 (comment), but the implementation seems to be in line enough with that for other directives and felt straightforward to me. This PR shall bring feature parity for all four major directives, and all five directives can now have new-tabbed variants. As a plus, customisation is allowed for this directive's new-tab button text as well, either by a global replite_button_text value or on a per-directive basis.

Changes made

  • A new RepliteTab class that inherits from docutils.nodes.Element. Here, we construct a URL for the REPL based on the input; and we return it when the :new_tab: option is enabled; otherwise, we return RepliteIframe instead.
  • Documentation updated for the global replite_button_text option for conf.py, and a sample directive added to showcase Replite opening in a new tab.

@agriyakhetarpal
Copy link
Member Author

I've opened yet another PR today where your review would be appreciated, @Carreau 😁 Thanks a lot!

@agriyakhetarpal agriyakhetarpal added the enhancement New feature or request label Dec 13, 2024
@agriyakhetarpal agriyakhetarpal changed the title Add a new-tabbed variant for the Replite directive, and allow customisation of button texts Add a new-tabbed variant for the Replite directive, and allow customisation of its button texts Dec 13, 2024
@agriyakhetarpal agriyakhetarpal changed the title Add a new-tabbed variant for the Replite directive, and allow customisation of its button texts Add a new-tabbed variant for the Replite directive, and allow customisation of its button text Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant