@patternfly/quickstarts 6.2.0-prerelease.4 → 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 +31 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -19
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-full.es.js +2451 -4932
- package/dist/quickstarts-full.es.js.map +1 -1
- package/package.json +2 -2
- package/src/ConsoleInternal/components/markdown-view.tsx +34 -23
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var server = require('react-dom/server');
|
|
|
14
14
|
var CopyIcon = require('@patternfly/react-icons/dist/js/icons/copy-icon');
|
|
15
15
|
var LightbulbIcon = require('@patternfly/react-icons/dist/js/icons/lightbulb-icon');
|
|
16
16
|
var FireIcon = require('@patternfly/react-icons/dist/js/icons/fire-icon');
|
|
17
|
-
var
|
|
17
|
+
var marked = require('marked');
|
|
18
18
|
var SyncAltIcon = require('@patternfly/react-icons/dist/js/icons/sync-alt-icon');
|
|
19
19
|
var CheckCircleIcon = require('@patternfly/react-icons/dist/js/icons/check-circle-icon');
|
|
20
20
|
require('@patternfly/react-icons/dist/js/icons/exclamation-circle-icon');
|
|
@@ -1208,16 +1208,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1208
1208
|
|
|
1209
1209
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1210
1210
|
const DOMPurify = require('dompurify');
|
|
1211
|
-
const markdownConvert = (markdown, extensions) => {
|
|
1212
|
-
const converter = new showdown.Converter({
|
|
1213
|
-
tables: true,
|
|
1214
|
-
openLinksInNewWindow: true,
|
|
1215
|
-
strikethrough: true,
|
|
1216
|
-
emoji: false,
|
|
1217
|
-
});
|
|
1218
|
-
if (extensions) {
|
|
1219
|
-
converter.addExtension(extensions);
|
|
1220
|
-
}
|
|
1211
|
+
const markdownConvert = (markdown, extensions) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
1221
1212
|
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1222
1213
|
// nodeType 1 = element type
|
|
1223
1214
|
var _a;
|
|
@@ -1268,16 +1259,36 @@ const markdownConvert = (markdown, extensions) => {
|
|
|
1268
1259
|
node.setAttribute('xlink:show', 'new');
|
|
1269
1260
|
}
|
|
1270
1261
|
});
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1262
|
+
// Replace code fences with non markdown formatting relates tokens so that marked doesn't try to parse them as code spans
|
|
1263
|
+
const markdownWithSubstitutedCodeFences = markdown.replace(/```/g, '@@@');
|
|
1264
|
+
const parsedMarkdown = yield marked.marked.parse(markdownWithSubstitutedCodeFences);
|
|
1265
|
+
// Swap the temporary tokens back to code fences before we run the extensions
|
|
1266
|
+
let md = parsedMarkdown.replace(/@@@/g, '```');
|
|
1267
|
+
if (extensions) {
|
|
1268
|
+
// Convert code spans back to md format before we run the custom extension regexes
|
|
1269
|
+
md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
|
|
1270
|
+
extensions.forEach(({ regex, replace }) => {
|
|
1271
|
+
if (regex) {
|
|
1272
|
+
md = md.replace(regex, replace);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
// Convert any remaining backticks back into code spans
|
|
1276
|
+
md = md.replace(/`(.*)`/g, '<code>$1</code>');
|
|
1277
|
+
}
|
|
1278
|
+
return DOMPurify.sanitize(md);
|
|
1279
|
+
});
|
|
1278
1280
|
const SyncMarkdownView = ({ content, emptyMsg, extensions, renderExtension, exactHeight, inline, className, }) => {
|
|
1279
1281
|
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1280
|
-
const markup = React__namespace.
|
|
1282
|
+
const [markup, setMarkup] = React__namespace.useState('');
|
|
1283
|
+
React__namespace.useEffect(() => {
|
|
1284
|
+
function getMd() {
|
|
1285
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
1286
|
+
const md = yield markdownConvert(content || emptyMsg || getResource('Not available'), extensions);
|
|
1287
|
+
setMarkup(md);
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
getMd();
|
|
1291
|
+
}, [content, emptyMsg, getResource, extensions]);
|
|
1281
1292
|
const innerProps = {
|
|
1282
1293
|
renderExtension: (extensions === null || extensions === void 0 ? void 0 : extensions.length) > 0 ? renderExtension : undefined,
|
|
1283
1294
|
exactHeight,
|