@patternfly/quickstarts 6.2.0-prerelease.3 → 6.2.0-prerelease.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConsoleInternal/components/markdown-view.d.ts +1 -1
- package/dist/index.es.js +34 -23
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +32 -21
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-full.es.js +2453 -4934
- package/dist/quickstarts-full.es.js.map +1 -1
- package/package.json +2 -2
- package/src/ConsoleInternal/components/markdown-view.tsx +34 -23
- package/src/QuickStartCatalogPage.tsx +6 -5
|
@@ -4,7 +4,7 @@ interface ShowdownExtension {
|
|
|
4
4
|
regex?: RegExp;
|
|
5
5
|
replace?: (...args: any[]) => string;
|
|
6
6
|
}
|
|
7
|
-
export declare const markdownConvert: (markdown:
|
|
7
|
+
export declare const markdownConvert: (markdown: string, extensions?: ShowdownExtension[]) => Promise<any>;
|
|
8
8
|
interface SyncMarkdownProps {
|
|
9
9
|
content?: string;
|
|
10
10
|
emptyMsg?: string;
|
package/dist/index.es.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { useIsomorphicLayoutEffect, Tooltip, Alert, CodeBlock, Accordion, AccordionItem, AccordionToggle, AccordionContent, Popover, PopoverPosition, Button, Icon, Flex, FlexItem, Card, CardHeader, CardTitle, CardBody, Stack, Label, CardFooter, Gallery, ToolbarItem, SearchInput, Select, SelectList, SelectOption, MenuToggle, Badge, Toolbar, ToolbarContent, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateActions, PageSection, Content,
|
|
3
|
+
import { useIsomorphicLayoutEffect, Tooltip, Alert, CodeBlock, Accordion, AccordionItem, AccordionToggle, AccordionContent, Popover, PopoverPosition, Button, Icon, Flex, FlexItem, Card, CardHeader, CardTitle, CardBody, Stack, Label, CardFooter, Gallery, ToolbarItem, SearchInput, Select, SelectList, SelectOption, MenuToggle, Badge, Toolbar, ToolbarContent, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateActions, PageSection, Content, Title, Divider, WizardNavItem, ExpandableSection, List, ListItem, Radio, ActionList, ActionListGroup, ActionListItem, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, StackItem } from '@patternfly/react-core';
|
|
4
4
|
import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
|
|
7
|
-
import { __rest } from 'tslib';
|
|
7
|
+
import { __rest, __awaiter } from 'tslib';
|
|
8
8
|
import { Modal as Modal$1, ModalVariant } from '@patternfly/react-core/deprecated';
|
|
9
9
|
import * as ReactDOM from 'react-dom';
|
|
10
10
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
11
11
|
import CopyIcon from '@patternfly/react-icons/dist/js/icons/copy-icon';
|
|
12
12
|
import LightbulbIcon from '@patternfly/react-icons/dist/js/icons/lightbulb-icon';
|
|
13
13
|
import FireIcon from '@patternfly/react-icons/dist/js/icons/fire-icon';
|
|
14
|
-
import {
|
|
14
|
+
import { marked } from 'marked';
|
|
15
15
|
import SyncAltIcon from '@patternfly/react-icons/dist/js/icons/sync-alt-icon';
|
|
16
16
|
import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
|
|
17
17
|
import '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
@@ -1168,16 +1168,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1168
1168
|
|
|
1169
1169
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1170
1170
|
const DOMPurify = require('dompurify');
|
|
1171
|
-
const markdownConvert = (markdown, extensions) => {
|
|
1172
|
-
const converter = new Converter({
|
|
1173
|
-
tables: true,
|
|
1174
|
-
openLinksInNewWindow: true,
|
|
1175
|
-
strikethrough: true,
|
|
1176
|
-
emoji: false,
|
|
1177
|
-
});
|
|
1178
|
-
if (extensions) {
|
|
1179
|
-
converter.addExtension(extensions);
|
|
1180
|
-
}
|
|
1171
|
+
const markdownConvert = (markdown, extensions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1181
1172
|
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1182
1173
|
// nodeType 1 = element type
|
|
1183
1174
|
var _a;
|
|
@@ -1228,16 +1219,36 @@ const markdownConvert = (markdown, extensions) => {
|
|
|
1228
1219
|
node.setAttribute('xlink:show', 'new');
|
|
1229
1220
|
}
|
|
1230
1221
|
});
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1222
|
+
// Replace code fences with non markdown formatting relates tokens so that marked doesn't try to parse them as code spans
|
|
1223
|
+
const markdownWithSubstitutedCodeFences = markdown.replace(/```/g, '@@@');
|
|
1224
|
+
const parsedMarkdown = yield marked.parse(markdownWithSubstitutedCodeFences);
|
|
1225
|
+
// Swap the temporary tokens back to code fences before we run the extensions
|
|
1226
|
+
let md = parsedMarkdown.replace(/@@@/g, '```');
|
|
1227
|
+
if (extensions) {
|
|
1228
|
+
// Convert code spans back to md format before we run the custom extension regexes
|
|
1229
|
+
md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
|
|
1230
|
+
extensions.forEach(({ regex, replace }) => {
|
|
1231
|
+
if (regex) {
|
|
1232
|
+
md = md.replace(regex, replace);
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
// Convert any remaining backticks back into code spans
|
|
1236
|
+
md = md.replace(/`(.*)`/g, '<code>$1</code>');
|
|
1237
|
+
}
|
|
1238
|
+
return DOMPurify.sanitize(md);
|
|
1239
|
+
});
|
|
1238
1240
|
const SyncMarkdownView = ({ content, emptyMsg, extensions, renderExtension, exactHeight, inline, className, }) => {
|
|
1239
1241
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1240
|
-
const markup = React.
|
|
1242
|
+
const [markup, setMarkup] = React.useState('');
|
|
1243
|
+
React.useEffect(() => {
|
|
1244
|
+
function getMd() {
|
|
1245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1246
|
+
const md = yield markdownConvert(content || emptyMsg || getResource('Not available'), extensions);
|
|
1247
|
+
setMarkup(md);
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
getMd();
|
|
1251
|
+
}, [content, emptyMsg, getResource, extensions]);
|
|
1241
1252
|
const innerProps = {
|
|
1242
1253
|
renderExtension: (extensions === null || extensions === void 0 ? void 0 : extensions.length) > 0 ? renderExtension : undefined,
|
|
1243
1254
|
exactHeight,
|
|
@@ -1836,8 +1847,8 @@ const QuickStartCatalogPage = ({ quickStarts, showFilter, sortFnc = (q1, q2) =>
|
|
|
1836
1847
|
}
|
|
1837
1848
|
return (React.createElement(React.Fragment, null,
|
|
1838
1849
|
(showTitle || showFilter) && (React.createElement(PageSection, { hasBodyWrapper: false },
|
|
1839
|
-
showTitle && (React.createElement(
|
|
1840
|
-
React.createElement(
|
|
1850
|
+
showTitle && (React.createElement(Content, { isEditorial: true },
|
|
1851
|
+
React.createElement(Title, { headingLevel: "h1", "data-test": "page-title" }, title || getResource('Quick Starts')),
|
|
1841
1852
|
hint && React.createElement("div", null, hint))),
|
|
1842
1853
|
showTitle && React.createElement(Divider, { component: "div" }),
|
|
1843
1854
|
showFilter && (React.createElement(React.Fragment, null,
|