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

Expand macro button for mdbook #16

Open
Veykril opened this issue Sep 25, 2020 · 2 comments
Open

Expand macro button for mdbook #16

Veykril opened this issue Sep 25, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@Veykril
Copy link
Owner

Veykril commented Sep 25, 2020

It would be quite nice if aside from a play-button the rust source blocks would offer an expand macros-button that just does that through the playground. I am not sure whether this is possible to get into mdbook so that has to be figured out.

@sigmaSd
Copy link
Contributor

sigmaSd commented Sep 30, 2020

Hi @Veykril, I i opened a PR implementing your idea rust-lang/mdBook#1343 you can check the discussion there if you want to add your opinion.

Personally I think cargo-expand is too verbose, and adding selected snippets where needed is a good enough way (like its already done in some sections of the book).

Also at least the book does mentions rust play ground macro expand function.

@Veykril
Copy link
Owner Author

Veykril commented Sep 30, 2020

Ye I would've guessed that adding something like that upstream to mdbook itself wouldn't work out. I mainly put this issue up for tracking the idea as it could be nice. It's not that important but I'll leave this up anyways, maybe someone wants to work on it when bored.

The two options I'd see, similar to what ehuss said in the PR:

  • Either build the expanded output for examples at build time somehow, and include them via spoilers in the output html with some css/js fiddling.
  • Send an expand request to the playground with additional-js etc.

@Veykril Veykril added the enhancement New feature or request label Oct 1, 2020
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

No branches or pull requests

2 participants