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

Markdown link open a new tab/window #3473

Open
ciberkids opened this issue Jul 27, 2017 · 5 comments
Open

Markdown link open a new tab/window #3473

ciberkids opened this issue Jul 27, 2017 · 5 comments

Comments

@ciberkids
Copy link

  • swagger-ui version: v3.0.21
swagger: '2.0'
info:
  version: "1.0.0-alpha"
  title: Answer to life
  description: |

      # Documentation

      This endpoint can solve the problems of the world:
      [look at its specification](#/WorldEndpoint)

paths:
  #  endpoints
  /:
    get:
      summary: the answer is 42
      description: |
        # Information
          for understanding this endpoint you have to have a look at the
          [Documentation](#/Documentation)
      operationId: getanswer
      tags:
        - WorldEndpoint
      responses:
        200:
          description: The api information is returned. 

Using this example is impossible to have a normal navigation between the two generated paragraph.

The link from the "Documentation" section open a new tab/window.
The link from the endpoint it isn't referring the paragraph.

As a solution I would like to suggest these two things:

  • intercept the default href behaviour and add the "preventdefault" and the call to the "scrolltosource" (into the Markdown provider)
  • add ids to the h1 - h3 header in order to use the solution mentioned above.

the problem has been tested here: http://editor.swagger.io/#/

@owenconti
Copy link
Contributor

@ciberkids I have a PR to fix the links opening in a new tab issue. I'll discuss with @webron if we want to pursue the anchor links idea.

@ciberkids
Copy link
Author

ciberkids commented Aug 2, 2017

@owenconti Thank you very much for your work,
I tried the fix proposed in the pull request, actually, the link doesn't bring any more in a new page/tab, but the page is in any case forced to reload, that it isn't the smoothest experience for a user, I think that this patch could work as temporary but if I would like to implement a side menu mechanism this could bring a lot of problems.

@shockey
Copy link
Contributor

shockey commented Aug 5, 2017

Note that the PR for this was closed.

This is a tricky request - an arbitrary anchor may not be in the DOM when it is referenced from another part of the page, since we skip rendering chunks of the spec when the content is hidden behind a Collapse.

@akrz
Copy link

akrz commented Jan 2, 2019

@shockey And if its not Collapsed? How can we scroll to the anchor?

@honza-zidek
Copy link

Any progress here please?

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

6 participants