edmondop commented on issue #10768:
URL: https://github.com/apache/datafusion/issues/10768#issuecomment-2299282817
@alamb there might still good reasons to consider snipsync or an approach
such as the one that snipsync implements:
- We do have examples in two places: in the user guide and
in`datafusion-examples`. With snipsync apprach, they will all be in a single
location and could be imported in the markdown
- Using comments/tags, it would be possible to import in the markdown only a
portion of the example by looking at comments, so that the reader can focus on
the relevant part of the code
What do you think about modifying the macro to support these two features?
- external example (specifying the path)
- using comments in the rust code
```rust
use std::error::Error;
// Snipstart: "Snip1"
print!("foo");
// Snipend
print!("Some uninteresting code");
// Snipstart: "Errors"
panic!("Something went wrong");
// Snipend
```
```md
You can print foo in Datafusion using the `print!` macro:
<!--include examples/example_1.rs snip-name="Snip1" -->
Another important feature in Datafusion is `panic!`, which can be used like
so:
<!--include examples/example_1.rs snip-name="Errors" -->
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]