Skip to content
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

Wrong enclosure for data type with multiple lines at markdown #223

Closed
crazymind1337 opened this issue Feb 26, 2020 · 5 comments
Closed

Wrong enclosure for data type with multiple lines at markdown #223

crazymind1337 opened this issue Feb 26, 2020 · 5 comments

Comments

@crazymind1337
Copy link

crazymind1337 commented Feb 26, 2020

Describe the Bug

If I add a data type with mutliple line, it will be enclosured with single "`" (inline code section) instead of tripple "`" (multi-line code fences). This causes a strange view at a markdownv viewer.

Expected Behavior

It should be enclosed with \n<text>\n

Expected result:

Alias of

\```
Hash[Pattern[/^[a-z][a-z0-9_-]*$/], Struct[
    {
      param1 => String[1],
      param2 => Stdlib::Absolutepath,
      paramX => Boolean,
    }
  ]
]
\```

Steps to Reproduce

Steps to reproduce the behavior:

  1. add a custom data type, e.g.:
# summary Test Type
#
type Test_module::Test_type = Hash[
  Pattern[/^[a-z][a-z0-9_-]*$/],
  Struct[
    {
      param1 => String[1],
      param2 => Stdlib::Absolutepath,
      paramX => Boolean,
    }
  ]
]
  1. generate the REFERENCE.md:
puppet strings generate --format markdown --out REFERENCE.md
  1. check the result, it will be like:
Alias of `Hash[Pattern[/^[a-z][a-z0-9_-]*$/], Struct[
    {
      param1 => String[1],
      param2 => Stdlib::Absolutepath,
      paramX => Boolean,
    }
  ]]`

Environment

  • Gem puppet-strings (2.3.1)
  • Platform MacOS 10.15.3 (19D76)
@binford2k
Copy link
Contributor

binford2k commented Mar 18, 2020

I've reproduced this issue with the example case provided and puppet-strings 2.5.0. Thanks for letting us know @crazymind1337!

@DavidS DavidS added the Triaged label Jan 18, 2021
danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 27, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.
danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 27, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
@danielparks
Copy link
Contributor

Looks like this is already in place for data type aliases, but it would be nice to extend that to default values and data types where we can. I have a branch that fixes this: danielparks/puppet-strings@better_public_private...danielparks:puppet-strings:multiline_code_blocks (it’s waiting on PR #314, my unsubmitted fix for #240, and possibly PUP-11632).

Also, thanks @crazymind1337, I was surprised that I couldn’t just use a multiline Variant type as a test case, so I used your example.

danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 27, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
@danielparks
Copy link
Contributor

Oh, I just figured out that I can link to a commit at the end of a branch without specifying the actual hash. Cool!

danielparks@multiline_code_blocks

danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 27, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 28, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 29, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 29, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
danielparks added a commit to danielparks/puppet-strings that referenced this issue Sep 29, 2022
Sometimes data types, default values, and other code outputted in
Markdown documentation is multiline. When that’s the case, it’s cleaner
to use a code block (below) rather and inline code (`code`).

```
example code block
with two lines
```

This updates the Markdown template code to use code blocks in many
places if the code in question contains a newline.

Thanks to @crazymind1337 for the example of a multiline type alias!
chelnak added a commit that referenced this issue Sep 29, 2022
(#223) Use code blocks as appropriate in Markdown
@danielparks
Copy link
Contributor

Change merged!

@crazymind1337
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants