Skip to content

Commit 15cdfe1

Browse files
authored
improvement: generate non-smart Markdown quotes (via #5162)
1 parent 0047ce9 commit 15cdfe1

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/core/components/providers/markdown.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function Markdown({ source, className = "" }) {
3535
linkTarget: "_blank"
3636
})
3737

38+
md.core.ruler.disable(["replacements", "smartquotes"])
39+
3840
const html = md.render(source)
3941
const sanitized = sanitizer(html)
4042

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
swagger: '2.0'
3+
info:
4+
title: Foobar Service
5+
description: '<br><p>Example of a simple GET request via curl with bearer HTTP Authentication:</p><pre>curl
6+
-X GET "https://foobar.com/stuff" -H "Accept: application/json" -H "Authorization:
7+
Bearer abc123.xyz.789"</pre>'
8+
version: '2.0'
9+
paths: {}
10+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
describe("#5060: unwanted smart quotes in rendered Markdown", () => {
2+
it("should not convert regular quotes to smart quotes", () => {
3+
cy
4+
.visit("/?url=/documents/bugs/5060.yaml")
5+
.get("div.description")
6+
.should($el => {
7+
const text = $el.get(0).textContent
8+
expect(text).to.include(`Example of a simple GET request via curl with bearer HTTP Authentication`)
9+
expect(text).to.include(`curl -X GET "https://foobar.com/stuff"`)
10+
expect(text).to.include(`-H "Accept: application/json"`)
11+
expect(text).to.include(`-H "Authorization: Bearer abc123.xyz.789"`)
12+
expect(text.indexOf(`“`)).to.equal(-1)
13+
})
14+
})
15+
})

0 commit comments

Comments
 (0)