Veykril / tlborm

The Little Book of Rust Macros (updated fork)
https://veykril.github.io/tlborm/
MIT License
705 stars 90 forks source link

Expand macro button for mdbook #16

Open Veykril opened 3 years ago

Veykril commented 3 years ago

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 commented 3 years ago

Hi @Veykril, I i opened a PR implementing your idea https://github.com/rust-lang/mdBook/pull/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 commented 3 years ago

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: