primitivefinance / primitive-dodoc

☄️ Zero-config Hardhat plugin to generate documentation for all your Solidity contracts.
MIT License
135 stars 16 forks source link

Gitbook not rendering @dev properly #26

Open 0x6080 opened 2 years ago

0x6080 commented 2 years ago

When using gitbook with dodoc, it seems the @dev is rendered improperly. For example:

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

creates:

:::note Details Returns the address of the current owner.
:::

Tried with /// instead of /* */ and still no dice.

image

Also using the same docusaurus.sql as Primitive:

---
description: {{@if (it.title)}}{{it.title}}{{/if}}

---

{{@if (it.name)}}# {{it.name}}.sol{{/if}}

{{@if (it.notice)}}{{it.notice}}{{/if}}

{{@if (it.details)}}
:::note Details
{{it.details}}

:::
{{/if}}

{{@if (Object.keys(it.methods).length > 0)}}
## Methods

{{@foreach(it.methods) => key, val}}
### {{key}}

{{@if (val.notice)}}{{val.notice}}{{/if}}

solidity title="Solidity"
{{val.code}}

{{@if (val.details)}}
:::note Details
{{val.details}}

:::
{{/if}}

{{@if (Object.keys(val.inputs).length > 0)}}
#### Parameters

| Name | Type | Description |
|---|---|---|
{{@foreach(val.inputs) => key, val}}
| {{key}} | {{val.type}} | {{val.description}}

{{/foreach}}
{{/if}}

{{@if (Object.keys(val.outputs).length > 0)}}
#### Returns

| Name | Type | Description |
|---|---|---|
{{@foreach(val.outputs) => key, val}}
| {{key}} | {{val.type}} | {{val.description}}

{{/foreach}}

{{/if}}
{{/foreach}}

{{/if}}

{{@if (Object.keys(it.events).length > 0)}}
## Events

{{@foreach(it.events) => key, val}}
### {{key}}

{{@if (val.notice)}}{{val.notice}}{{/if}}

solidity title="Solidity"
{{val.code}}

{{@if (val.details)}}
:::note Details
{{val.details}}

:::
{{/if}}

{{@if (Object.keys(val.inputs).length > 0)}}
#### Parameters

| Name | Type | Description |
|---|---|---|
{{@foreach(val.inputs) => key, val}}
| {{key}} {{@if (val.indexed)}}`indexed`{{/if}} | {{val.type}} | {{val.description}} |
{{/foreach}}
{{/if}}

{{/foreach}}

{{/if}}

{{@if (Object.keys(it.errors).length > 0)}}
## Errors

{{@foreach(it.errors) => key, val}}
### {{key}}

{{@if (val.notice)}}{{val.notice}}{{/if}}

solidity title="Solidity"
{{val.code}}

{{@if (val.details)}}
:::note Details
{{val.details}}

:::
{{/if}}

{{@if (Object.keys(val.inputs).length > 0)}}
#### Parameters

| Name | Type | Description |
|---|---|---|
{{@foreach(val.inputs) => key, val}}
| {{key}} | {{val.type}} | {{val.description}} |
{{/foreach}}
{{/if}}

{{/foreach}}

{{/if}}

Any idea how to work around this?

clemlak commented 2 years ago

Hey, thanks for reporting this issue!

I think the problem is coming from the missing | in some arrays of the template. I'm going to publish a new version of Dodoc soon, but if you don't want to wait you can either:

0x6080 commented 2 years ago

Just wanted to let you know that the issue currently persists for me after those steps and using the dev branch docusaurus.sqrl. Maybe some other issue?

clemlak commented 2 years ago

Oh really? I'll check this out then, we are updating the Docusaurus template so that's an opportunity to solve potential issues.