Переглянути джерело

improvement: generate non-smart Markdown quotes (via #5162)

bubble
kyle 5 роки тому
committed by GitHub
джерело
коміт
15cdfe14dd
Не вдалося знайти GPG ключ що відповідає даному підпису Ідентифікатор GPG ключа: 4AEE18F83AFDEB23
3 змінених файлів з 27 додано та 0 видалено
  1. +2
    -0
      src/core/components/providers/markdown.jsx
  2. +10
    -0
      test/e2e-cypress/static/documents/bugs/5060.yaml
  3. +15
    -0
      test/e2e-cypress/tests/bugs/5060.js

+ 2
- 0
src/core/components/providers/markdown.jsx Переглянути файл

@@ -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)



+ 10
- 0
test/e2e-cypress/static/documents/bugs/5060.yaml Переглянути файл

@@ -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
- 0
test/e2e-cypress/tests/bugs/5060.js Переглянути файл

@@ -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)
})
})
})

Завантаження…
Відмінити
Зберегти