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

adding some handlebar examples to README #290

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

snreynolds
Copy link

Creating draft PR as I have a couple more examples to add and would be good to get your feedback too

Copy link
Contributor

@frangio frangio left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 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
Copy link
Contributor

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:

Suggested change
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.

Comment on lines +46 to +48
``` {{{natspec.userdoc}}}
{{{natspec.devdoc}}}
```
Copy link
Contributor

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.

Comment on lines +52 to +53
This is the comment next to the @notice tag.
This is the comment next to the @dev tag.
Copy link
Contributor

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}}
Copy link
Contributor

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.

Suggested change
- {{param}}
- {{param}}: {{description}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants