docify icon indicating copy to clipboard operation
docify copied to clipboard

feature request: include doc comments in embed

Open liamaharon opened this issue 2 years ago • 4 comments

It would be helpful if the doc comment for exported items could be optionally included with the code.

liamaharon avatar Sep 17 '23 18:09 liamaharon

Yes I was actually thinking about this when I saw your previous issue. I'll see if I can work it in soon

sam0x17 avatar Sep 20 '23 15:09 sam0x17

Ideally, I would expand this to any attribute. #[doc = ".."] is then merely one specialized case for this.

So, we need a way to say:

  1. bring in all attributes (default behavior)
  2. don't bring in any attributes,
  3. bring in only these attributes
  4. bring in all attributes except these.

kianenigma avatar Oct 13 '23 10:10 kianenigma

if we want to get that granular, might make sense to simply have an additional attribute #[docify::capture_attrs_start] and #[docify::capture_attrs_end] which will capture any attributes appearing between those two and also include them in the export. You could do multiple capture regions in the same item. that is the simplest API I can think of that can do all of the above

could also have a convenience #[docify::capture_attrs] that just gets all of them.

For all of the above, docify-related attributes would be ignored

sam0x17 avatar Oct 13 '23 16:10 sam0x17

Simplest use case is that atm

#[docify::export]
/// A mapping from `T::AccountId` to `Balance`.
#[pallet::storage]
pub type Balances<T: Config> = StorageMap<Key = T::AccountId, Value = Balance>;

is not capable of picking up the docs, and it would be good if it does. No strong opinion about the syntax.

kianenigma avatar Apr 02 '24 10:04 kianenigma