Skip to content

Commit 26cf51a

Browse files
authored
Inheritdoc fix (#26)
* fix variable declaration inheritdoc and add support for multiple dev comments * add limitation and update patch version
1 parent 0d734d6 commit 26cf51a

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,4 @@ contract Example {
236236
## Known limitations
237237

238238
- `Vyper` is currently not supported.
239+
- `inheritdoc` parsing is ignored for state variable declarations.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solarity/hardhat-markup",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"description": "Customizable markdown smart contracts documentation",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",

src/generator/md-generator/MDGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class MDGenerator {
6565
}
6666

6767
if (documentation.dev) {
68-
res.push(documentation.dev);
68+
res.push(...documentation.dev);
6969
}
7070

7171
if (documentation.custom) {

src/parser/Parser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,11 @@ export class Parser {
486486
}
487487
case "dev": {
488488
if (!natSpec.dev) {
489-
natSpec.dev = text;
489+
natSpec.dev = [];
490490
}
491491

492+
natSpec.dev.push(text);
493+
492494
break;
493495
}
494496
case "param": {
@@ -588,6 +590,8 @@ export class Parser {
588590
parentNode = this.findFunctionDefinitionByContractName(node, parentName);
589591
} else if (node.nodeType === "ModifierDefinition") {
590592
parentNode = this.findModifierDefinitionByContractName(node, parentName);
593+
} else if (node.nodeType === "VariableDeclaration") {
594+
break;
591595
}
592596

593597
if (!parentNode) {

src/parser/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface NatSpecDocumentation {
2121
title?: string;
2222
author?: string;
2323
notice?: string;
24-
dev?: string;
24+
dev?: string[];
2525
params?: {
2626
name?: string;
2727
type?: string;

0 commit comments

Comments
 (0)