diff --git a/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx b/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx index 6f244647922ef..b023805ffde2d 100644 --- a/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx +++ b/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx @@ -7,7 +7,14 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; + +const Markdown: React.FC<{ markdown: string; openLinksInNewTab?: boolean }> = ({ + markdown, + openLinksInNewTab, +}) => { + return ; +}; export const initialSection = ( = ({ markdown }) => { + return ; +}; export const initialSection = ( = ({ src }) => ( + +); diff --git a/src/plugins/controls/public/control_group/component/control_error_component.tsx b/src/plugins/controls/public/control_group/component/control_error_component.tsx index 409455f0e304e..87341149ee390 100644 --- a/src/plugins/controls/public/control_group/component/control_error_component.tsx +++ b/src/plugins/controls/public/control_group/component/control_error_component.tsx @@ -10,7 +10,7 @@ import React, { useState } from 'react'; import { EuiButtonEmpty, EuiPopover } from '@elastic/eui'; import { FormattedMessage, I18nProvider } from '@kbn/i18n-react'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; interface ControlErrorProps { error: Error | string; @@ -46,8 +46,9 @@ export const ControlError = ({ error }: ControlErrorProps) => { anchorClassName="errorEmbeddableCompact__popoverAnchor" closePopover={() => setPopoverOpen(false)} > - diff --git a/src/plugins/controls/tsconfig.json b/src/plugins/controls/tsconfig.json index a386f5146e21b..c86c35aac18d4 100644 --- a/src/plugins/controls/tsconfig.json +++ b/src/plugins/controls/tsconfig.json @@ -36,6 +36,7 @@ "@kbn/safer-lodash-set", "@kbn/ui-actions-plugin", "@kbn/core-mount-utils-browser", + "@kbn/shared-ux-markdown", ], "exclude": [ "target/**/*", diff --git a/src/plugins/discover/public/application/context/hooks/use_context_app_fetch.tsx b/src/plugins/discover/public/application/context/hooks/use_context_app_fetch.tsx index eb69c5910e3f6..f862bca57ff07 100644 --- a/src/plugins/discover/public/application/context/hooks/use_context_app_fetch.tsx +++ b/src/plugins/discover/public/application/context/hooks/use_context_app_fetch.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { toMountPoint } from '@kbn/react-kibana-mount'; -import { MarkdownSimple } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import type { DataView } from '@kbn/data-views-plugin/public'; import { SortDirection } from '@kbn/data-plugin/public'; import type { DataTableRecord } from '@kbn/discover-utils/types'; @@ -105,7 +105,7 @@ export function useContextAppFetch({ setState(createError('anchorStatus', FailureReason.UNKNOWN, error)); toastNotifications.addDanger({ title: errorTitle, - text: toMountPoint({error.message}, { + text: toMountPoint(, { theme: services.core.theme, i18n: services.core.i18n, }), @@ -160,7 +160,7 @@ export function useContextAppFetch({ setState(createError(statusKey, FailureReason.UNKNOWN, error)); toastNotifications.addDanger({ title: errorTitle, - text: toMountPoint({error.message}, { + text: toMountPoint(, { theme: services.core.theme, i18n: services.core.i18n, }), diff --git a/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx b/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx index cc51f11885ea4..58423a3acb10b 100644 --- a/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx +++ b/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx @@ -15,7 +15,7 @@ import type { Rule } from '@kbn/alerting-plugin/common'; import type { RuleTypeParams } from '@kbn/alerting-plugin/common'; import { ISearchSource, SerializedSearchSourceFields, getTime } from '@kbn/data-plugin/common'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { MarkdownSimple } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import { toMountPoint } from '@kbn/react-kibana-mount'; import { Filter } from '@kbn/es-query'; import { DiscoverAppLocatorParams } from '../../../common/locator'; @@ -83,7 +83,7 @@ export const getAlertUtils = ( }); toastNotifications.addDanger({ title: errorTitle, - text: toMountPoint({error.message}, { + text: toMountPoint(, { theme: core.theme, i18n: core.i18n, }), @@ -106,7 +106,7 @@ export const getAlertUtils = ( }); toastNotifications.addDanger({ title: errorTitle, - text: toMountPoint({error.message}, { + text: toMountPoint(, { theme: core.theme, i18n: core.i18n, }), diff --git a/src/plugins/discover/tsconfig.json b/src/plugins/discover/tsconfig.json index 6fca69dfaea5c..97fd6e2658506 100644 --- a/src/plugins/discover/tsconfig.json +++ b/src/plugins/discover/tsconfig.json @@ -74,6 +74,7 @@ "@kbn/rule-data-utils", "@kbn/global-search-plugin", "@kbn/resizable-layout", + "@kbn/shared-ux-markdown", "@kbn/core-chrome-browser" ], "exclude": [ diff --git a/src/plugins/embeddable/public/embeddable_panel/embeddable_panel_error.tsx b/src/plugins/embeddable/public/embeddable_panel/embeddable_panel_error.tsx index 8d7055b342ce2..6fde91c7a0b92 100644 --- a/src/plugins/embeddable/public/embeddable_panel/embeddable_panel_error.tsx +++ b/src/plugins/embeddable/public/embeddable_panel/embeddable_panel_error.tsx @@ -12,7 +12,7 @@ import React, { ReactNode, useEffect, useMemo, useState } from 'react'; import { EuiButtonEmpty, EuiEmptyPrompt, EuiText } from '@elastic/eui'; import type { MaybePromise } from '@kbn/utility-types'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import { ErrorLike } from '@kbn/expressions-plugin/common'; import { EditPanelAction } from './panel_actions'; @@ -65,12 +65,8 @@ export function EmbeddablePanelError({ return ( - + + } data-test-subj="embeddableStackError" diff --git a/src/plugins/embeddable/public/lib/embeddables/error_embeddable.test.tsx b/src/plugins/embeddable/public/lib/embeddables/error_embeddable.test.tsx index d932018c3f4fe..ee58358035472 100644 --- a/src/plugins/embeddable/public/lib/embeddables/error_embeddable.test.tsx +++ b/src/plugins/embeddable/public/lib/embeddables/error_embeddable.test.tsx @@ -29,11 +29,23 @@ test('ErrorEmbeddable renders an embeddable with markdown message', async () => await waitFor(() => getByTestId('errorMessageMarkdown')); // wait for lazy markdown component expect(getByText(/some link/i)).toMatchInlineSnapshot(` some link + + External link + + + (opens in a new tab or window) + `); }); diff --git a/src/plugins/embeddable/tsconfig.json b/src/plugins/embeddable/tsconfig.json index 9055c59c2d846..3a31acd2e8969 100644 --- a/src/plugins/embeddable/tsconfig.json +++ b/src/plugins/embeddable/tsconfig.json @@ -34,6 +34,7 @@ "@kbn/react-kibana-mount", "@kbn/unified-search-plugin", "@kbn/data-views-plugin", + "@kbn/shared-ux-markdown", ], "exclude": ["target/**/*"] } diff --git a/src/plugins/expression_error/public/components/error/error.tsx b/src/plugins/expression_error/public/components/error/error.tsx index 4fe51aede4a64..485ae8f9736c2 100644 --- a/src/plugins/expression_error/public/components/error/error.tsx +++ b/src/plugins/expression_error/public/components/error/error.tsx @@ -9,7 +9,7 @@ import React, { FC } from 'react'; import { EuiButtonIcon, EuiCallOut } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import { ShowDebugging } from './show_debugging'; export interface Props { @@ -47,7 +47,7 @@ export const Error: FC = ({ payload, onClose }) => {

{message ? strings.getDescription() : ''}

{message && (

- +

)} diff --git a/src/plugins/expression_error/tsconfig.json b/src/plugins/expression_error/tsconfig.json index 1cda452adcb70..d9fc54315dc43 100644 --- a/src/plugins/expression_error/tsconfig.json +++ b/src/plugins/expression_error/tsconfig.json @@ -16,6 +16,7 @@ "@kbn/i18n", "@kbn/kibana-react-plugin", "@kbn/i18n-react", + "@kbn/shared-ux-markdown", ], "exclude": [ "target/**/*", diff --git a/src/plugins/kibana_react/public/index.ts b/src/plugins/kibana_react/public/index.ts index e7244459a5c72..57beca70321a4 100644 --- a/src/plugins/kibana_react/public/index.ts +++ b/src/plugins/kibana_react/public/index.ts @@ -70,10 +70,14 @@ export { ValidatedDualRange } from './validated_range'; export type { ToastInput, KibanaReactNotifications } from './notifications'; export { createNotifications } from './notifications'; +export { toMountPoint } from './util'; + /** @deprecated use `Markdown` from `@kbn/shared-ux-markdown` */ -export { Markdown, MarkdownSimple } from './markdown'; +export { + MarkdownButThisComponentIsDEPRECATED, + MarkdownSimpleButThisComponentIsDEPRECATED, +} from './markdown'; -export { toMountPoint } from './util'; export type { ToMountPointOptions } from './util'; /** @deprecated Use `RedirectAppLinks` from `@kbn/shared-ux-link-redirect-app` */ diff --git a/src/plugins/kibana_react/public/markdown/index.tsx b/src/plugins/kibana_react/public/markdown/index.tsx index c15d4269cf3c0..6557f413c0291 100644 --- a/src/plugins/kibana_react/public/markdown/index.tsx +++ b/src/plugins/kibana_react/public/markdown/index.tsx @@ -19,7 +19,7 @@ const Fallback = () => ( /** @deprecated use `Markdown` from `@kbn/shared-ux-markdown` */ const LazyMarkdownSimple = React.lazy(() => import('./markdown_simple')); -export const MarkdownSimple = (props: MarkdownSimpleProps) => ( +export const MarkdownSimpleButThisComponentIsDEPRECATED = (props: MarkdownSimpleProps) => ( }> @@ -27,7 +27,7 @@ export const MarkdownSimple = (props: MarkdownSimpleProps) => ( /** @deprecated use `Markdown` from `@kbn/shared-ux-markdown` */ const LazyMarkdown = React.lazy(() => import('./markdown')); -export const Markdown = (props: MarkdownProps) => ( +export const MarkdownButThisComponentIsDEPRECATED = (props: MarkdownProps) => ( }> diff --git a/src/plugins/vis_type_markdown/kibana.jsonc b/src/plugins/vis_type_markdown/kibana.jsonc index 476dcc0605ad4..d3d1d3bd9f29b 100644 --- a/src/plugins/vis_type_markdown/kibana.jsonc +++ b/src/plugins/vis_type_markdown/kibana.jsonc @@ -13,7 +13,6 @@ ], "requiredBundles": [ "expressions", - "kibanaReact", "visDefaultEditor", "visualizations" ] diff --git a/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx b/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx index 963f3b0ecbbb2..04f86e815e841 100644 --- a/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx +++ b/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx @@ -29,7 +29,9 @@ describe('markdown vis controller', () => { expect(getByText('markdown')).toMatchInlineSnapshot(` markdown @@ -53,7 +55,8 @@ describe('markdown vis controller', () => { expect(getByText(/testing/i)).toMatchInlineSnapshot(`

- Testing <a>html</a> + Testing + html

`); }); diff --git a/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx b/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx index 60df18d60a15e..cb250734009f4 100644 --- a/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx +++ b/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx @@ -7,7 +7,7 @@ */ import React, { useEffect } from 'react'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import { MarkdownVisParams } from './types'; import './markdown_vis.scss'; @@ -25,12 +25,8 @@ const MarkdownVisComponent = ({ useEffect(renderComplete); // renderComplete will be called after each render to signal, that we are done with rendering. return ( -
- +
+
); }; diff --git a/src/plugins/vis_type_markdown/tsconfig.json b/src/plugins/vis_type_markdown/tsconfig.json index 73c6d160696ac..833dc7404cc0f 100644 --- a/src/plugins/vis_type_markdown/tsconfig.json +++ b/src/plugins/vis_type_markdown/tsconfig.json @@ -12,11 +12,11 @@ "@kbn/core", "@kbn/expressions-plugin", "@kbn/visualizations-plugin", - "@kbn/kibana-react-plugin", "@kbn/vis-default-editor-plugin", "@kbn/i18n", "@kbn/i18n-react", "@kbn/config-schema", + "@kbn/shared-ux-markdown", ], "exclude": [ "target/**/*", diff --git a/src/plugins/vis_types/timeseries/public/application/components/vis_types/markdown/vis.js b/src/plugins/vis_types/timeseries/public/application/components/vis_types/markdown/vis.js index 0701f9498c793..732a59750bd8d 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/vis_types/markdown/vis.js +++ b/src/plugins/vis_types/timeseries/public/application/components/vis_types/markdown/vis.js @@ -11,8 +11,7 @@ import React from 'react'; import classNames from 'classnames'; import { get } from 'lodash'; import { ClassNames } from '@emotion/react'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; - +import { MarkdownButThisComponentIsDEPRECATED } from '@kbn/kibana-react-plugin/public'; import { ErrorComponent } from '../../error'; import { replaceVars } from '../../lib/replace_vars'; import { convertSeriesToVars } from '../../lib/convert_series_to_vars'; @@ -77,7 +76,7 @@ function MarkdownVisualization(props) { >
{!markdownError && ( - - {error.message} + ), }); diff --git a/src/plugins/visualizations/tsconfig.json b/src/plugins/visualizations/tsconfig.json index b428e361d1985..f0791546d0891 100644 --- a/src/plugins/visualizations/tsconfig.json +++ b/src/plugins/visualizations/tsconfig.json @@ -64,7 +64,8 @@ "@kbn/serverless", "@kbn/no-data-page-plugin", "@kbn/search-response-warnings", - "@kbn/logging" + "@kbn/logging", + "@kbn/shared-ux-markdown" ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx b/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx index 3e4ddc36413c2..c47dd97a736a6 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx @@ -17,7 +17,10 @@ import { import { i18n } from '@kbn/i18n'; import React, { ComponentType } from 'react'; import styled from 'styled-components'; -import { Markdown, useKibana } from '@kbn/kibana-react-plugin/public'; +import { + MarkdownButThisComponentIsDEPRECATED, + useKibana, +} from '@kbn/kibana-react-plugin/public'; import { AgentRuntimeAttachmentProps, CreateAgentInstructions, @@ -74,7 +77,7 @@ function AccordionButtonContent({ function InstructionsContent({ markdown }: { markdown: string }) { return ( - = ({ bannerConfig }) => { }} >
- +
); diff --git a/x-pack/plugins/banners/tsconfig.json b/x-pack/plugins/banners/tsconfig.json index e79f9107075f5..019a4ebd7da88 100644 --- a/x-pack/plugins/banners/tsconfig.json +++ b/x-pack/plugins/banners/tsconfig.json @@ -11,6 +11,7 @@ "@kbn/licensing-plugin", "@kbn/config-schema", "@kbn/i18n", + "@kbn/shared-ux-markdown", ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx index fd1e2415d0589..e610ee6bc6052 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx @@ -11,7 +11,7 @@ import { CoreTheme } from '@kbn/core/public'; import { Observable } from 'rxjs'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import { StartInitializer } from '../../plugin'; import { RendererStrings } from '../../../i18n'; import { Return as Config } from '../../functions/browser/markdown'; @@ -31,10 +31,11 @@ export const getMarkdownRenderer = ReactDOM.render( - , diff --git a/x-pack/plugins/canvas/tsconfig.json b/x-pack/plugins/canvas/tsconfig.json index 45b22e422dc6e..f957160795629 100644 --- a/x-pack/plugins/canvas/tsconfig.json +++ b/x-pack/plugins/canvas/tsconfig.json @@ -84,6 +84,7 @@ "@kbn/content-management-plugin", "@kbn/react-kibana-context-theme", "@kbn/shared-ux-page-kibana-template", + "@kbn/shared-ux-markdown", ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx index 0911f648077c6..de24d3f4e5792 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Markdown } from '@kbn/kibana-react-plugin/public'; +import * as md from '@kbn/shared-ux-markdown'; import { groupBy } from 'lodash'; import type { IndexPattern } from '../../../../../../types'; import { tinymathFunctions } from '../util'; @@ -39,7 +39,7 @@ function createNewSection( <>

{getFunctionSignatureLabel(key, operationDefinitionMap, false)}

- {fnDescription ? : null} + {fnDescription ? : null} ), }; @@ -92,8 +92,9 @@ export function getDocumentationSections({ defaultMessage: 'Filter ratio', }), description: ( -