@patternfly/quickstarts 6.2.0-prerelease.5 → 6.2.0-prerelease.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/quickstarts",
3
- "version": "6.2.0-prerelease.5",
3
+ "version": "6.2.0-prerelease.6",
4
4
  "description": "PatternFly quick starts",
5
5
  "files": [
6
6
  "src",
@@ -71,8 +71,20 @@ export const markdownConvert = async (markdown: string, extensions?: ShowdownExt
71
71
  }
72
72
  });
73
73
 
74
- // Replace code fences with non markdown formatting relates tokens so that marked doesn't try to parse them as code spans
75
- const markdownWithSubstitutedCodeFences = markdown.replace(/```/g, '@@@');
74
+ const reverseString = (str: string) => str.split('').reverse().join('');
75
+
76
+ // replace code fences that end in a double curly brace (which are used by our custom md extensions) with non
77
+ // markdown formatting related tokens so that marked doesn't try to parse them as code spans
78
+ //
79
+ // we want to reverse the string before we do the substitution so that we only match the opening code fence which
80
+ // corresponds to the closing code fence with the double curly brace
81
+ const reversedMarkdown = reverseString(markdown);
82
+ const reverseMarkdownWithSubstitutedCodeFences = reversedMarkdown.replace(
83
+ /{{```((.|\n)*?)```/g,
84
+ '{{@@@$1@@@',
85
+ );
86
+ const markdownWithSubstitutedCodeFences = reverseString(reverseMarkdownWithSubstitutedCodeFences);
87
+
76
88
  const parsedMarkdown = await marked.parse(markdownWithSubstitutedCodeFences);
77
89
  // Swap the temporary tokens back to code fences before we run the extensions
78
90
  let md = parsedMarkdown.replace(/@@@/g, '```');