Skip to content

improvement: generate non-smart Markdown quotes #5162

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

Merged
merged 2 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/components/providers/markdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function Markdown({ source, className = "" }) {
linkTarget: "_blank"
})

md.core.ruler.disable(["replacements", "smartquotes"])

const html = md.render(source)
const sanitized = sanitizer(html)

Expand Down
10 changes: 10 additions & 0 deletions test/e2e-cypress/static/documents/bugs/5060.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
swagger: '2.0'
info:
title: Foobar Service
description: '<br><p>Example of a simple GET request via curl with bearer HTTP Authentication:</p><pre>curl
-X GET "https://foobar.com/stuff" -H "Accept: application/json" -H "Authorization:
Bearer abc123.xyz.789"</pre>'
version: '2.0'
paths: {}

15 changes: 15 additions & 0 deletions test/e2e-cypress/tests/bugs/5060.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe("#5060: unwanted smart quotes in rendered Markdown", () => {
it("should not convert regular quotes to smart quotes", () => {
cy
.visit("/?url=/documents/bugs/5060.yaml")
.get("div.description")
.should($el => {
const text = $el.get(0).textContent
expect(text).to.include(`Example of a simple GET request via curl with bearer HTTP Authentication`)
expect(text).to.include(`curl -X GET "https://foobar.com/stuff"`)
expect(text).to.include(`-H "Accept: application/json"`)
expect(text).to.include(`-H "Authorization: Bearer abc123.xyz.789"`)
expect(text.indexOf(`“`)).to.equal(-1)
})
})
})