quasar-ui-danx 0.4.23 → 0.4.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/danx.es.js +691 -691
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +32 -32
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/formats.ts +5 -2
package/package.json
CHANGED
package/src/helpers/formats.ts
CHANGED
@@ -376,7 +376,7 @@ export function parseMarkdownYAML(string: string): object | null | false {
|
|
376
376
|
* Parse a markdown formatted string and return the code block content
|
377
377
|
*/
|
378
378
|
export function parseMarkdownCode(string: string): string {
|
379
|
-
return string.replace(/^```[a-z0-9]{
|
379
|
+
return string.replace(/^```[a-z0-9]{0,6}\s/, "").replace(/```$/, "");
|
380
380
|
}
|
381
381
|
|
382
382
|
/**
|
@@ -384,6 +384,7 @@ export function parseMarkdownCode(string: string): string {
|
|
384
384
|
* ie: a valid JSON string with a ```json prefix and ``` postfix
|
385
385
|
*/
|
386
386
|
export function fMarkdownCode(type: string, string: string | object): string {
|
387
|
+
console.log("formatting", type, string);
|
387
388
|
if (typeof string === "object" || isJSON(string)) {
|
388
389
|
switch (type) {
|
389
390
|
case "yaml":
|
@@ -396,7 +397,9 @@ export function fMarkdownCode(type: string, string: string | object): string {
|
|
396
397
|
}
|
397
398
|
|
398
399
|
const regex = new RegExp(`\`\`\`${type}`, "g");
|
399
|
-
|
400
|
+
string = (string || "") as string;
|
401
|
+
if (!string.match(regex)) {
|
402
|
+
string = parseMarkdownCode(string as string);
|
400
403
|
return `\`\`\`${type}\n${string}\n\`\`\``;
|
401
404
|
}
|
402
405
|
|