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

fix: using the appropriate markdown contexts when necessary #558

Merged
merged 1 commit into from
Mar 23, 2020
Merged
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
14 changes: 12 additions & 2 deletions packages/api-explorer/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ const PropTypes = require('prop-types');
const extensions = require('@readme/oas-extensions');
const VariablesContext = require('@readme/variable/contexts/Variables');
const OauthContext = require('@readme/variable/contexts/Oauth');
const GlossaryTermsContext = require('@readme/markdown/contexts/GlossaryTerms');
const BaseUrlContext = require('@readme/markdown/contexts/BaseUrl');
const SelectedAppContext = require('@readme/variable/contexts/SelectedApp');

const ErrorBoundary = require('./ErrorBoundary');
Expand Down Expand Up @@ -182,6 +180,18 @@ class ApiExplorer extends React.Component {
return true;
});

/* eslint-disable global-require */
let BaseUrlContext;
let GlossaryTermsContext;
if (this.props.useNewMarkdownEngine) {
BaseUrlContext = require('@readme/markdown/contexts/BaseUrl');
GlossaryTermsContext = require('@readme/markdown/contexts/GlossaryTerms');
} else {
BaseUrlContext = require('@readme/markdown-magic/contexts/BaseUrl');
GlossaryTermsContext = require('@readme/markdown-magic/contexts/GlossaryTerms');
}
/* eslint-enable global-require */

return (
<div className={`is-lang-${this.state.language}`}>
<div
Expand Down