Skip to content

Add custom playground guide for v0.5 - #3124

Open
dalance wants to merge 1 commit into
rust-lang:mainfrom
dalance:custom-playground-v0.5
Open

dalance wants to merge 1 commit into
rust-lang:mainfrom
dalance:custom-playground-v0.5

Conversation

@dalance

@dalance dalance commented May 22, 2026

Copy link
Copy Markdown
Contributor

This PR documents how to implement custom playgrounds.

This is a successor to PR #2286.
The method described in #2286 is no longer available in v0.5, so it has been rewritten for v0.5, and
it was possible to implement it with fewer patches than the previous version.

Related: #350 #1453 #1759

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label May 22, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

Sorry for the delay, we now have an mdbook team so things should move a bit faster here. This sounds like a very good idea to add an example! Do you mind adding a GUI test to ensure that the code you provided won't become outdated when we make updates?

@GuillaumeGomez GuillaumeGomez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need a GUI test using the JS code example to ensure it doesn't become outdated.

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: waiting on a review labels Sep 2, 2026
@rustbot

rustbot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@dalance

dalance commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your review.
I'm glad the mdBook team has been established.

When I wrote this documentation, I understood that review bandwidth was extremely limited,
so I wrote a procedure which can be implemented without making changes to mdBook itself.

If minor changes are acceptable, I can clean up some of the JavaScript hacks, what do you think?
For example, if we slightly adjusted the condition at

if !is_playground {
,
the section titled "Restrict the .playground selector to <pre>" will no longer be necessary.

@GuillaumeGomez

Copy link
Copy Markdown
Member

If that can make things simpler, then it's worth a try!

@dalance

dalance commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

I wrote 2 issues to improve custome playground support.
If both of them are accepted, the way of this PR is significantly simplified because theme override is not necessary.
Especially it is important that book.js override is not necessary because it causes manual synchronization to mdBook update.

@dalance

dalance commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@GuillaumeGomez
I created #3218.

Regarding #3216, since it would have a bit large impact, such as requiring the addition of a configuration value,
I'd like to prepare it only after reaching a certain level of consensus.
What do you think?

If there is no prospect of it being accepted in the short term, I am also open to rewriting this guide on the assumption that #3216 can't be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants