You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever AI replies with a rust code block, we want to add a link/button to the Rust Playground website attaching the given code. (Later on to be expanded to support other languages/websites).
Requirements to display the button:
Message must be markdown
In chat_line.rs the following heuristic is used to determine if the message is markdown (perhaps this can be reused):
let to_markdown = parse_markdown(&text);let is_plain_text = to_markdown.nodes.len() <= 3;
Message must include a rust code block ```rs ... ``` or ```rust ... ```
Opening the playground
We should open the Rust Playground URL by using robius-open, e.g. robius_open::Uri::new(&some_url).open(). This is already being used in Moxin.
The Rust Playground website allows attaching code to its URL: https://play.rust-lang.org/?code=<your-encoded-code-here>.
Design is up for discussion, but I would suggest using something like a small ferris (rust mascot) PNG. It can be gray, and turn orange (the ferris color) on hover.
The text was updated successfully, but these errors were encountered:
joulei
changed the title
Add a link for Rust Playground whenever AI replied with rust code
Add a link for Rust Playground whenever AI replies with rust code
Sep 10, 2024
joulei
changed the title
Add a link for Rust Playground whenever AI replies with rust code
Display a link for Rust Playground whenever AI replies with rust code
Sep 10, 2024
Whenever AI replies with a rust code block, we want to add a link/button to the Rust Playground website attaching the given code. (Later on to be expanded to support other languages/websites).
Requirements to display the button:
In
chat_line.rs
the following heuristic is used to determine if the message is markdown (perhaps this can be reused):Opening the playground
We should open the Rust Playground URL by using robius-open, e.g.
robius_open::Uri::new(&some_url).open()
. This is already being used in Moxin.The Rust Playground website allows attaching code to its URL:
https://play.rust-lang.org/?code=<your-encoded-code-here>
.For example, opening a Rust Playground including a simple hello world, can be done with the following URL:
https://play.rust-lang.org/?code=fn%20main()%20%7B%0A%20%20%20%20println!%28%22Hello%2C%20world!%22%29%3B%0A%7D
Design is up for discussion, but I would suggest using something like a small ferris (rust mascot) PNG. It can be gray, and turn orange (the ferris color) on hover.
The text was updated successfully, but these errors were encountered: