seed icon indicating copy to clipboard operation
seed copied to clipboard

Add documentation for macros

Open L0g4n opened this issue 5 years ago • 4 comments

Most of the macros exported by seed are undocumented, see: https://docs.rs/seed/0.7.0/seed/#macros It would be good if at least the most commonly used are documented with an example.

L0g4n avatar Sep 16 '20 11:09 L0g4n

Hello, I was looking into the macros today.

It seems many of them are generated from there, is it right ?

element! {
    address => Address; article => Article; aside => Aside; footer => Footer;
    header => Header; h1 => H1;
...
 }

So I am not sure if we can document them this way.

Also there is the comment


// @TODO merge with make_tags!
// El must be exposed in the module where this is called for these to work.

So maybe should we do try what the comment says and then see if we can document it? Maybe we could close this issue if it is not relevant anymore.

What do you think about it @MartinKavik and @L0g4n ?

arn-the-long-beard avatar Jan 08 '21 13:01 arn-the-long-beard

I can imagine we can add a doc comment like Autogenerated element macro for generated macros with a link to more info or to associated MDN page if possible or something like that.

MartinKavik avatar Jan 09 '21 14:01 MartinKavik

I saw this today. It is old but maybe useful https://stackoverflow.com/questions/33999341/generating-documentation-in-macros

arn-the-long-beard avatar Feb 16 '21 10:02 arn-the-long-beard

I saw this today. It is old but maybe useful https://stackoverflow.com/questions/33999341/generating-documentation-in-macros

This does work though as expected, every macro would have the same documentation.

But maybe that's not be too bad considering that they mostly function the same.

What might also be useful is to include a link to the element macros section of the official guide. Since some people probably don't want to go to another site even if it's the official one, we can include the general principles of element macros, how they translate to html, and one or two generic examples in the docs.

It seems possible to make the macro documentation somewhat less generic based on this SO thread but it's from way back in 2017. I'm not too savvy with macros so I wasn't able to make it work.

flawphobic avatar May 24 '21 09:05 flawphobic