-
Notifications
You must be signed in to change notification settings - Fork 119
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
adding some handlebar examples to README #290
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @snreynolds! This is going to be really useful for people. I think the current examples are already a great start, so I would be happy to merge only these examples, but if you want to add more by all means go ahead.
I think the formatting needs a little work and I've left some concrete comments below.
``` | ||
|
||
|
||
## Example Handlebars Formatting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Example Handlebars Formatting | |
## Example Handlebars Templates | |
You can customize the output of solidity-docgen through Handlebars templates, using the `-t` argument in the command line with the path to the directory where the `contract.hbs` template file is located. For example, `solidity-docgen -t templates`. |
|
||
Each of the following examples will go through various methods exposed by the solidity-docgen library, how to use them in handlebars, and what the resulting markdown output would look like. | ||
|
||
1. Getting the natspec @dev and @notice tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting rendered as a numbered list and I think we want them to look more like headings, so I would go with:
1. Getting the natspec @dev and @notice tags | |
### 1. Getting the natspec @dev and @notice tags |
And we should increase the nesting of the two subsections in each of these.
``` {{{natspec.userdoc}}} | ||
{{{natspec.devdoc}}} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub doesn't let me leave a suggestion for this, but the first line of each of these code blocks is not being displayed in the Markdown rendering. The first line needs to be on its own line, like so:
```handlebars {{{natspec.userdoc}}} {{{natspec.devdoc}}} ```
If we add handlebars
at the top it will probably display with some syntax highlighting.
This is the comment next to the @notice tag. | ||
This is the comment next to the @dev tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should display the output in a code block as well, so like:
This is the comment next to the @notice tag.
This is the comment next to the @dev tag.
#### function {{name}} | ||
Parameters: | ||
{{natspec.params}} | ||
- {{param}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to also include the description.
- {{param}} | |
- {{param}}: {{description}} |
Creating draft PR as I have a couple more examples to add and would be good to get your feedback too