docify icon indicating copy to clipboard operation
docify copied to clipboard

`docify::embed_diff`

Open kianenigma opened this issue 1 year ago • 2 comments

#![doc = docify::embed_diff("file_path.rs", item_1, item_2)]

There must be good diff libs for rust, and the rest is more or less simple, I presume. We read the two excerpts, pass them to the fn diff(a, b), which I presume would return some sort of diff-style string, and use that.

How crazy is this?

cc @shawntabrizi

kianenigma avatar Oct 30 '23 09:10 kianenigma

This would be cool, and yes there should be good crates for this, and as long as we use diff on the code blocks, it should syntax highlight I think

sam0x17 avatar Oct 30 '23 15:10 sam0x17

For context, when writing tutorials, it is common to have before and after steps (both of which compile), and want to present a diff from the two.

At least that is the clear use case for me.

shawntabrizi avatar Nov 02 '23 23:11 shawntabrizi