-
Notifications
You must be signed in to change notification settings - Fork 38
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
Resolving imports for Rust code execution #365
Comments
Someone added support for rust-script so if you tag the code block with I haven't really used this but it should work. Let me know if it doesn't! |
Oh, that's perfect! It partly solves my problem. Now the real challenge is: ````rust-script +line_numbers +exec
//! ```cargo
//! [dependencies]
//! ratatui = "0.28.1"
//! ```
use ratatui::{
crossterm::event::{self, Event},
text::Text,
Frame,
};
fn main() {
let mut terminal = ratatui::init();
loop {
terminal
.draw(|frame: &mut Frame| {
frame
.render_widget(Text::raw("Hello World!"), frame.area())
})
.expect("failed to draw frame");
if matches!(
event::read().expect("failed to read event"),
Event::Key(_)
) {
break;
}
}
ratatui::restore();
}
```` I can't run TUI applications inside Is there a way to It would be super awesome to have this feature somehow since my presentation will be about TUIs. Otherwise I need to spawn another terminal to show the output of the code. |
I created a PR for this #366, you need to annotate the code snippet with |
Thanks for the quick implementation! It works quite well with the code block I provided above. I also tried out different examples and the result is chef's kiss. However, I realized now that the code blocks that are not executed yet say Also, inline links (e.g. I'm not sure if those are new features that are not released yet or a bug caused by the PR. |
Yeah, I wasn't really sure what to do here. There's no "starting" this as it runs every time you run it, as opposed to normal snippet execution that can only run once. Any ideas on what to replace it with?
This was implemented in #334 and is not released yet. To get the previous behavior you need to have links with empty titles, e.g. |
It feels a bit verbose to add another label. Also, I didn't quite get the case where this is shown. Can you elaborate it further?
Ah, nice feature :) Updated my slides accordingly, thanks for pointing it out! |
The label/bar is there to display the state of the execution of the snippet. For the new acquire terminal mode, there is no state as you're either running presenterm or running the snippet. Once the snippet ends, control flow goes back to presenterm. I think it would be good to have some way of indicating this is a runnable script that will acquire the terminal but I don't know off the top of my head how (see #278 for rationale on this). |
Ah, got it. Thanks for the explanation - I think it makes sense! I had some time to test |
There's a bunch of changes going out in the next release but I need to do some relatively major fix on something that's going to take a bit of time. I'll make sure something goes out before your talk, that should be enough time for me to work on this. |
Sounds good to me! I will be using the Thanks for your work on this 💯 |
Hey again!
Is there a way to handle dependencies when using executable code blocks in the presentation. For example, I want to import a library like so:
But unfortunately this fails (when I do
C-e
) with import errors.Is this currently possible to do so with
presenterm
? If not, would you be interested in supporting this?The text was updated successfully, but these errors were encountered: