From bcd6478db397b5a56b0926fd9f9c29a2d68b90ce Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 14 Oct 2020 17:25:14 -0700 Subject: [PATCH] chore(deps): upgrading @readme/markdown to hide code copy buttons (#986) * chore(deps): upgrading @readme/markdown to hide code copy buttons * test: fixing a broken test --- .../form-components/DescriptionField.test.jsx | 11 ++++------- packages/api-explorer/package-lock.json | 12 ++++++------ packages/api-explorer/package.json | 2 +- packages/api-explorer/src/Doc.jsx | 2 +- packages/api-explorer/src/ResponseSchema.jsx | 2 +- packages/api-explorer/src/ResponseSchemaBody.jsx | 2 +- packages/api-explorer/src/block-types/Content.jsx | 3 ++- .../src/form-components/DescriptionField.jsx | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/api-explorer/__tests__/form-components/DescriptionField.test.jsx b/packages/api-explorer/__tests__/form-components/DescriptionField.test.jsx index 6dcc77272..2e078d052 100644 --- a/packages/api-explorer/__tests__/form-components/DescriptionField.test.jsx +++ b/packages/api-explorer/__tests__/form-components/DescriptionField.test.jsx @@ -9,15 +9,12 @@ test.each([[true], [false]])('should parse description as markdown [new markdown let html; if (useNewMarkdownEngine) { - html = mount(markdown.react(actual)).html(); + html = mount(markdown.react(actual, { copyButtons: false })).html(); } else { html = shallow(markdownMagic(actual)).html(); } - // I wanted to use http://airbnb.io/enzyme/docs/api/ShallowWrapper/contains.html here but it wasnt working - expect( - shallow() - .html() - .indexOf(html) > 1 - ).toBe(true); + expect(shallow().html()).toContain( + html + ); }); diff --git a/packages/api-explorer/package-lock.json b/packages/api-explorer/package-lock.json index 833f9e455..19f9ac780 100644 --- a/packages/api-explorer/package-lock.json +++ b/packages/api-explorer/package-lock.json @@ -1290,9 +1290,9 @@ "integrity": "sha512-sC94wCjHfHYt87j+pKnG6FaKMX0N6BLBINPokR3XXGv43lhT32qbFbWDzmBuiJOC4PRHg0M4kMsBToVH47V6mA==" }, "@readme/markdown": { - "version": "6.20.1", - "resolved": "https://registry.npmjs.org/@readme/markdown/-/markdown-6.20.1.tgz", - "integrity": "sha512-qsM7JN5a9UVNVsqxGXA1NfUbaO76PfzeIXBcAmed4+ResFYzEm0AuOzIeTKH/6Jor52o8q0IymwmG1dIR9pW2w==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@readme/markdown/-/markdown-6.21.0.tgz", + "integrity": "sha512-ceVa0iLZiXpm+qINDo6qXfqNIusb42stiM6EvyJt9IKr8D/YTniRwj43Zd6d1rQU/dw1yVpzUQlQ2MPdGT9ffg==", "requires": { "@readme/emojis": "^1.0.0", "@readme/syntax-highlighter": "^6.15.2", @@ -8951,9 +8951,9 @@ } }, "property-information": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-5.5.0.tgz", - "integrity": "sha512-RgEbCx2HLa1chNgvChcx+rrCWD0ctBmGSE0M7lVm1yyv4UbvbrWoXp/BkVLZefzjrRBGW8/Js6uh/BnlHXFyjA==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz", + "integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==", "requires": { "xtend": "^4.0.0" } diff --git a/packages/api-explorer/package.json b/packages/api-explorer/package.json index 50307efda..b93e2e256 100644 --- a/packages/api-explorer/package.json +++ b/packages/api-explorer/package.json @@ -5,7 +5,7 @@ "main": "dist/index.js", "dependencies": { "@readme/http-status-codes": "^7.1.0", - "@readme/markdown": "^6.15.2", + "@readme/markdown": "^6.21.0", "@readme/markdown-magic": "^8.0.0", "@readme/oas-extensions": "^8.0.0", "@readme/oas-form": "^8.0.0", diff --git a/packages/api-explorer/src/Doc.jsx b/packages/api-explorer/src/Doc.jsx index 255c39a51..334f321b7 100644 --- a/packages/api-explorer/src/Doc.jsx +++ b/packages/api-explorer/src/Doc.jsx @@ -364,7 +364,7 @@ class Doc extends React.Component {

{doc.title}

{doc.excerpt && (
- {useNewMarkdownEngine ? markdown(doc.excerpt) : markdownMagic(doc.excerpt)} + {useNewMarkdownEngine ? markdown(doc.excerpt, { copyButtons: false }) : markdownMagic(doc.excerpt)}
)} diff --git a/packages/api-explorer/src/ResponseSchema.jsx b/packages/api-explorer/src/ResponseSchema.jsx index 361b1a35e..cdc64129c 100644 --- a/packages/api-explorer/src/ResponseSchema.jsx +++ b/packages/api-explorer/src/ResponseSchema.jsx @@ -99,7 +99,7 @@ class ResponseSchema extends React.Component { {response.description && (useNewMarkdownEngine ? (
-
{markdown(response.description)}
+
{markdown(response.description, { copyButtons: false })}
) : (
{markdownMagic(response.description)}
diff --git a/packages/api-explorer/src/ResponseSchemaBody.jsx b/packages/api-explorer/src/ResponseSchemaBody.jsx index f67c3a03d..793f9c798 100644 --- a/packages/api-explorer/src/ResponseSchemaBody.jsx +++ b/packages/api-explorer/src/ResponseSchemaBody.jsx @@ -16,7 +16,7 @@ function getSchemaType(schema) { function getDescriptionMarkdown(useNewMarkdownEngine, description) { if (useNewMarkdownEngine) { - return markdown(description); + return markdown(description, { copyButtons: false }); } return markdownMagic(description); diff --git a/packages/api-explorer/src/block-types/Content.jsx b/packages/api-explorer/src/block-types/Content.jsx index 375e1bb54..415bae3a5 100644 --- a/packages/api-explorer/src/block-types/Content.jsx +++ b/packages/api-explorer/src/block-types/Content.jsx @@ -47,8 +47,9 @@ const Content = props => { if (useNewMarkdownEngine) { const content = markdown(body, { - showAnchorIcons: splitReferenceDocs, compatibilityMode: flags.rdmdCompatibilityMode, + copyButtons: false, + showAnchorIcons: splitReferenceDocs, }); if (isThreeColumn === true) { diff --git a/packages/api-explorer/src/form-components/DescriptionField.jsx b/packages/api-explorer/src/form-components/DescriptionField.jsx index dae1863da..a1439e486 100644 --- a/packages/api-explorer/src/form-components/DescriptionField.jsx +++ b/packages/api-explorer/src/form-components/DescriptionField.jsx @@ -7,7 +7,7 @@ const markdownMagic = require('@readme/markdown-magic'); function getDescriptionMarkdown(useNewMarkdownEngine, description) { if (useNewMarkdownEngine) { - return markdown(description); + return markdown(description, { copyButtons: false }); } return markdownMagic(description);