Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for macros #543

Open
L0g4n opened this issue Sep 16, 2020 · 4 comments
Open

Add documentation for macros #543

L0g4n opened this issue Sep 16, 2020 · 4 comments
Labels
docs Missing examples, tutorials, guides, typos, .. good first issue Good for newcomers help wanted Extra attention is needed

Comments

@L0g4n
Copy link

L0g4n commented Sep 16, 2020

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.

@MartinKavik MartinKavik added docs Missing examples, tutorials, guides, typos, .. good first issue Good for newcomers help wanted Extra attention is needed labels Sep 16, 2020
@arn-the-long-beard
Copy link
Member

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 ?

@MartinKavik
Copy link
Member

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.

@arn-the-long-beard
Copy link
Member

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

@flawphobic
Copy link

flawphobic commented May 24, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Missing examples, tutorials, guides, typos, .. good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants