Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
chore(deps): upgrading @readme/markdown to hide code copy buttons (#986)
Browse files Browse the repository at this point in the history
* chore(deps): upgrading @readme/markdown to hide code copy buttons

* test: fixing a broken test
  • Loading branch information
erunion authored Oct 15, 2020
1 parent 7855a26 commit bcd6478
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(<DescriptionField description={actual} formContext={{ useNewMarkdownEngine }} />)
.html()
.indexOf(html) > 1
).toBe(true);
expect(shallow(<DescriptionField description={actual} formContext={{ useNewMarkdownEngine }} />).html()).toContain(
html
);
});
12 changes: 6 additions & 6 deletions packages/api-explorer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/Doc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class Doc extends React.Component {
<h2>{doc.title}</h2>
{doc.excerpt && (
<div className="markdown-body excerpt">
{useNewMarkdownEngine ? markdown(doc.excerpt) : markdownMagic(doc.excerpt)}
{useNewMarkdownEngine ? markdown(doc.excerpt, { copyButtons: false }) : markdownMagic(doc.excerpt)}
</div>
)}
</header>
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/ResponseSchema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ResponseSchema extends React.Component {
{response.description &&
(useNewMarkdownEngine ? (
<div className="markdown-body" style={{ padding: 0 }}>
<div className="pin">{markdown(response.description)}</div>
<div className="pin">{markdown(response.description, { copyButtons: false })}</div>
</div>
) : (
<div className="desc">{markdownMagic(response.description)}</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/ResponseSchemaBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getSchemaType(schema) {

function getDescriptionMarkdown(useNewMarkdownEngine, description) {
if (useNewMarkdownEngine) {
return markdown(description);
return markdown(description, { copyButtons: false });
}

return markdownMagic(description);
Expand Down
3 changes: 2 additions & 1 deletion packages/api-explorer/src/block-types/Content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bcd6478

Please sign in to comment.