-
Notifications
You must be signed in to change notification settings - Fork 12.3k
chore: add markdown docs templates #6030
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
Open
stevedylandev
wants to merge
2
commits into
OpenZeppelin:master
Choose a base branch
from
stevedylandev:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| const path = require('path'); | ||
| const fs = require('fs'); | ||
|
|
||
| /** @type import('solidity-docgen/dist/config').UserConfig */ | ||
| module.exports = { | ||
| outputDir: 'docs/modules/api/pages', | ||
| templates: 'docs/templates-md', | ||
| exclude: ['mocks'], | ||
| pageExtension: '.mdx', | ||
| pages: (_, file, config) => { | ||
| const sourcesDir = path.resolve(config.root, config.sourcesDir); | ||
| let dir = path.resolve(config.root, file.absolutePath); | ||
| while (dir.startsWith(sourcesDir)) { | ||
| dir = path.dirname(dir); | ||
| if (fs.existsSync(path.join(dir, 'README.adoc'))) { | ||
| return path.relative(sourcesDir, dir) + config.pageExtension; | ||
| } | ||
| } | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| {{reset-function-counts}}<a id="{{anchor}}"></a> | ||
|
|
||
| <div style=\{{marginTop: "4em"}} className="w-full flex flex-row items-center justify-between"> | ||
|
|
||
| ## `{{{name}}}` | ||
|
|
||
| <a target="_blank" style=\{{marginTop: "1.5em"}} href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v{{oz-version}}/{{__item_context.file.absolutePath}}"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-github-icon lucide-github"><path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/></svg> | ||
| </a> | ||
|
|
||
| </div> | ||
|
|
||
| ```solidity | ||
| import "@openzeppelin/{{__item_context.file.absolutePath}}"; | ||
| ``` | ||
|
|
||
| {{{process-natspec natspec.dev}}} | ||
|
|
||
| {{#if modifiers}} | ||
| <div className="bg-secondary p-4 rounded-md mb-6"> | ||
| <h3 style=\{{ marginTop: "0"}}>Modifiers</h3> | ||
| <div className="font-mono"> | ||
| {{#each modifiers}} | ||
| - [{{{name}}}({{names params}})](#{{anchor}}) | ||
| {{/each}} | ||
| </div> | ||
| </div> | ||
| {{/if}} | ||
|
|
||
|
|
||
| {{#if has-functions}} | ||
| <div className="bg-secondary p-4 rounded-md mb-6"> | ||
| <h3 style=\{{ marginTop: "0"}}>Functions</h3> | ||
| <div className="font-mono"> | ||
| {{#each inherited-functions}} | ||
| {{#unless @first}} | ||
| #### {{contract.name}} [!toc] | ||
| {{/unless}} | ||
| {{#each functions}} | ||
| - [{{{name}}}({{names params}})](#{{anchor}}) | ||
| {{/each}} | ||
| {{/each}} | ||
| </div> | ||
| </div> | ||
| {{/if}} | ||
|
|
||
| {{#if has-events}} | ||
| <div className="bg-secondary p-4 rounded-md mb-6"> | ||
| <h3 style=\{{ marginTop: "0"}}>Events</h3> | ||
| <div className="font-mono"> | ||
| {{#each inheritance}} | ||
| {{#unless @first}} | ||
| #### {{name}} [!toc] | ||
| {{/unless}} | ||
| {{#each events}} | ||
| - [{{{name}}}({{names params}})](#{{anchor}}) | ||
| {{/each}} | ||
| {{/each}} | ||
| </div> | ||
| </div> | ||
| {{/if}} | ||
|
|
||
| {{#if has-errors}} | ||
| <div className="bg-secondary p-4 rounded-md mb-6"> | ||
| <h3 style=\{{ marginTop: "0"}}>Errors</h3> | ||
| <div className="font-mono"> | ||
| {{#each inheritance}} | ||
| {{#unless @first}} | ||
| #### {{name}} [!toc] | ||
| {{/unless}} | ||
| {{#each errors}} | ||
| - [{{{name}}}({{names params}})](#{{anchor}}) | ||
| {{/each}} | ||
| {{/each}} | ||
| </div> | ||
| </div> | ||
| {{/if}} | ||
|
|
||
| {{#each modifiers}} | ||
| <a id="{{anchor}}"></a> | ||
|
|
||
| <div className="border rounded-md mb-4"> | ||
| <div className="bg-secondary flex w-full justify-between px-4"> | ||
| <p className="font-bold text-sm font-mono">{{{name}}}({{typed-params params}})</p> | ||
| <div className="flex flex-row items-center gap-2"> | ||
| <p className="font-light text-sm">{{visibility}}</p> | ||
| <a className="peer" data-card href="{{anchor}}">#</a> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="px-4"> | ||
|
|
||
| {{{process-natspec natspec.dev}}} | ||
|
|
||
| </div> | ||
| </div> | ||
|
|
||
| {{/each}} | ||
|
|
||
| {{#each functions}} | ||
| <a id="{{anchor}}"></a> | ||
|
|
||
| <div className="border rounded-md mb-4"> | ||
| <div className="bg-secondary flex w-full justify-between px-4"> | ||
| <p className="font-bold text-sm font-mono">{{{name}}}({{typed-params params}}){{#if returns2}} → {{typed-params returns2}}{{/if}}</p> | ||
| <div className="flex flex-row items-center gap-2"> | ||
| <p className="font-light text-sm">{{visibility}}</p> | ||
| <a className="peer" data-card href="{{anchor}}">#</a> | ||
| </div> | ||
| </div> | ||
| <div className="px-4"> | ||
|
|
||
| {{{process-natspec natspec.dev}}} | ||
|
|
||
| </div> | ||
| </div> | ||
|
|
||
| {{/each}} | ||
|
|
||
| {{#each events}} | ||
| <a id="{{anchor}}"></a> | ||
|
|
||
| <div className="border rounded-md mb-4"> | ||
| <div className="bg-secondary flex w-full justify-between px-4"> | ||
| <p className="font-bold text-sm font-mono">{{{name}}}({{typed-params params}})</p> | ||
| <div className="flex flex-row items-center gap-2"> | ||
| <p className="font-light text-sm">event</p> | ||
| <a className="peer" data-card href="{{anchor}}">#</a> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="px-4"> | ||
|
|
||
| {{{process-natspec natspec.dev}}} | ||
|
|
||
| </div> | ||
| </div> | ||
| {{/each}} | ||
|
|
||
| {{#each errors}} | ||
| <a id="{{anchor}}"></a> | ||
|
|
||
| <div className="border rounded-md mb-4"> | ||
| <div className="bg-secondary flex w-full justify-between px-4"> | ||
| <p className="font-bold text-sm font-mono">{{{name}}}({{typed-params params}})</p> | ||
| <div className="flex flex-row items-center gap-2"> | ||
| <p className="font-light text-sm">error</p> | ||
| <a className="peer" data-card href="{{anchor}}">#</a> | ||
stevedylandev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </div> | ||
| </div> | ||
| <div className="px-4"> | ||
|
|
||
| {{{process-natspec natspec.dev}}} | ||
|
|
||
| </div> | ||
| </div> | ||
|
|
||
| {{/each}} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.