opened
raymondbutcher
username_0
### Prerequisites

Put an `x` into the box that applies:

- [x] This issue describes a bug.
- [ ] This issue describes a feature request.

For more information, see the [Contributing Guidelines](https://github.com/segmentio/terraform-docs/tree/master/CONTRIBUTING.md).

### Description

In [this repository](https://github.com/username_0/terraform-aws-lambda-builder) I have used terraform-docs to generate the inputs and outputs in the main README.md.

I have a variable defined like this:

```
variable "vpc_config" {
  description = "Provide this to allow your function to access your VPC."
  type = object({
    security_group_ids = list(string)
    subnet_ids         = list(string)
  })
  default = null
}
```

The `type` gets rendered in HTML as a `<pre>` element and it is too wide. It causes the table to become too wide for the page and you need to scroll horizontally to see the last column.

Using regular backticks would make it render as `<code>` which wraps over multiple lines in GitHub and doesn't cause the table to become too wide. It would however need a comma to separate some of the lines to make sense. 

#### Actual Behavior

It outputs this:

```
| vpc\_config | Provide this to allow your function to access your VPC. | <pre>object({<br>    security_group_ids = list(string)<br>    subnet_ids         = list(string)<br>  })</pre> | n/a | yes |
```

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| vpc\_config | Provide this to allow your function to access your VPC. | <pre>object({<br>    security_group_ids = list(string)<br>    subnet_ids         = list(string)<br>  })</pre> | n/a | yes |

The table is too big for the page and it requires horizontal scrolling to see all columns.

#### Expected Behavior

I want it to render nicely on GitHub and not require horizontal scrolling.

I think something like this would be better:

```
| vpc\_config | Provide this to allow your function to access your VPC. | `object({ security_group_ids = list(string), subnet_ids = list(string) })` | n/a | yes |
```

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| vpc\_config | Provide this to allow your function to access your VPC. | `object({ security_group_ids = list(string), subnet_ids = list(string) })` | n/a | yes |

### Version

`0.8.1`
Horizontal scrolling in GitHub due to complex types
issue
created
khos2ow
username_1
Apologies for late response. This is unfortunately how markdown tables are being rendered and on top of that different markdown engines behave completely differently when rendering table. There was a whole discussion around it in #138 too. And to be honest having a horizontal scrollbar on a complex table is not that bad IMO, because it's _complex_ anyway.
comment
created
raymondbutcher
username_0
No problem!

I get that we're at the mercy of different rendering engines and websites, but I think it is worth trying to get GitHub to render it nicely. It is the home of many (I guess most) Terraform modules.

Could we make `<pre>` vs <code>`</code> an option?

A more difficult but perhaps better technique could be nested tables, for example:

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| vpc\_config | Provide this to allow your function to access your VPC. | <table><tr><th colspan="2">object</th></tr><tr><td>`security_group_ids`</td><td>`list(string)`</td></tr><tr><td>`subnet_ids`</td><td>`list(string)`</td></tr></table> | n/a | yes |

I say more difficult because I don't know if all complex types would translate very well into a nested table. I don't know. I think <code>`</code> would be fine.
comment
created
khos2ow
username_1
I personally don't like the ``` ` ``` approach because it would feel a little bit weird, after all it was a multi-line text which will end up in a wrapped one-line code, but I'm gonna look to see how hard would it be to add an optional (disabled by default) flag for this.

| Name | Description | Type | Default | Required |
|----------|----------------|---------|-----------|--------------|
| vpc\_config | Provide this to allow your function to access your VPC. | `object({ security_group_ids = list(string), subnet_ids = list(string) })` | n/a | yes |
| vpc\_config | Provide this to allow your function to access your VPC. | <pre>object({<br>    security_group_ids = list(string)<br>    subnet_ids         = list(string)<br>  })</pre> | n/a | yes |

Another point is that currently without any code change you still can achieve oneliner ``` ` ``` approach if you use the following:

```
variable "vpc_config" {
  description = "Provide this to allow your function to access your VPC."
  type = object({ security_group_ids = list(string) subnet_ids = list(string) })
  default = null
}
```

Also +1 on the proposed nested types, I'm definitely gonna explore that, but then again, it still won't solve the horizontal scrollbar.
comment