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

Unable to prevent plaintext links from rendering as hyperlinks #379

Closed
jroweboy opened this issue Nov 14, 2017 · 1 comment
Closed

Unable to prevent plaintext links from rendering as hyperlinks #379

jroweboy opened this issue Nov 14, 2017 · 1 comment

Comments

@jroweboy
Copy link

In my swagger.json file, I have a few raw links that are getting converted into hyperlinks, and I don't know how to prevent this. It ends up looking really bad when placed in a <pre> block.

Snippet from the swagger. json

"tags": [
  {"name":"overview",
   "description": "... Example: Using cURL, we can query the service locations <code>curl -I https://domain.com/api/v1/sl</code> and find the <code>Link</code> header<pre>Link: <https://domain.com/api/v1/sl?page=1>; rel=\"next\",\n  <https://domain.com/api/v1/sl?page=10>; rel=\"last\"\n</pre>"
  }
]

When rendered looks like
chrome_2017-11-14_11-12-46

I would love for some way to turn off hyperlink conversion in <pre> and <code> blocks as it doesn't make sense to have them as links (and it really clashes with the css as well). Any help is greatly appreciated.

@RomanHotsiy
Copy link
Member

@jroweboy instead of directly using <code> and <pre> use markdown mechanism for this so markdown renderer knows when to escape:

description: |
  ... Example: Using cURL, we can query the service locations `curl -I https://domain.com/api/v1/sl` and find the `Link` header
  ```
  Link: <https://domain.com/api/v1/sl?page=1>; rel="next",
  <https://domain.com/api/v1/sl?page=10>; rel="last"
  ```

or in json:

{
   "description": "... Example: Using cURL, we can query the service locations `curl -I https://domain.com/api/v1/sl` and find the `Link` header\n```\nLink: <https://domain.com/api/v1/sl?page=1>; rel=\"next\",\n<https://domain.com/api/v1/sl?page=10>; rel=\"last\"\n```\n"
}

There is an issue in the 1.16.2 version that didn't escape HTML characters in backticks blocks (#378) but it is fixed now and a new ReDoc version will be released soon.
As a temporal workaround, you can specify some language after backticks:

```html
Link: <https://domain.com/api/v1/sl?page=1>; rel="next",
<https://domain.com/api/v1/sl?page=10>; rel="last"
```

Closing the issue but feel free to continue the discussion here!

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

No branches or pull requests

2 participants