primitive-dodoc icon indicating copy to clipboard operation
primitive-dodoc copied to clipboard

Gitbook not rendering @dev properly

Open 0x6080 opened this issue 2 years ago • 3 comments

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?

0x6080 avatar Feb 20 '22 17:02 0x6080

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:

  • Fix the error manually by being sure that each line containing | {{key}} | {{val.type}} | {{val.description}} | ends with a |
  • OR install the develop package using npm install @primitivefi/hardhat-dodoc@develop or yarn add @primitivefi/hardhat-dodoc@develop

clemlak avatar Feb 21 '22 20:02 clemlak

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?

0x6080 avatar Mar 06 '22 17:03 0x6080

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

clemlak avatar Mar 07 '22 05:03 clemlak