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

fix: attachHeadingsDescriptions match headings incorrectly #1841

Closed
wants to merge 1 commit into from

Conversation

Celend
Copy link
Contributor

@Celend Celend commented Dec 24, 2021

What/Why/How?

if headings have same prefix, the description will mess up, see below:

info:
  openapi: 3.1.0
  title: test
  version: v1
  description: |+
    # intro
    # modules
    ## user_module
    some text
   
    ## user
    some text2

then you can see:
image

how to fix?
just match heading to end of the line.

Reference

Testing

Check yourself

  • Code is linted
  • Tested
  • All new/updated code is covered with tests

@Oprysk
Copy link
Contributor

Oprysk commented Dec 29, 2021

@Celend could you please attach the screenshots before and after fix?

@Oprysk
Copy link
Contributor

Oprysk commented Dec 30, 2021

@Celend I can't reproduce this issue. Maybe there is some specific configuration, with an example you've provided - all looks good.
If you have more details feel free to reopen this. Thanks!

@Oprysk Oprysk closed this Dec 30, 2021
@Celend
Copy link
Contributor Author

Celend commented Dec 30, 2021

@Oprysk This should be easy to reproduce, here is detail example.

good.yaml:

openapi: 3.1.0
info:
  title: test
  version: v1
  description: |+
    # intro
    # modules
    ## 1module
    some text
   
    ## 2module
    some text2

bad.yaml:

openapi: 3.1.0
info:
  title: test
  version: v1
  description: |+
    # intro
    # modules
    ## module1
    some text
   
    ## module
    some text2

reproduction:

$ npx redoc-cli --version
0.13.2
$ cat good.yaml
openapi: 3.1.0
info:
  title: test
  version: v1
  description: |+
    # intro
    # modules
    ## 1module
    some text

    ## 2module
    some text2
$ npx redoc-cli serve good.yaml
# see screenshot

$ cat bad.yaml
openapi: 3.1.0
info:
  title: test
  version: v1
  description: |+
    # intro
    # modules
    ## module1
    some text

    ## module
    some text2
$ npx redoc-cli serve bad.yaml
# see screenshot

good screenshot:

image

bad screenshot:

image

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

Successfully merging this pull request may close these issues.

2 participants