markdown-it-any-block 3.2.11 → 3.2.12

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.
@@ -234,8 +234,8 @@ function autoABAlias(header, selectorName, content) {
234
234
  return header;
235
235
  }
236
236
  const ABAlias_json_withSub = [
237
- { regex: /\|::: 140lne\|(info|note|warning|caution|attention|error|danger|tips|tip|hint|example|abstract|summary|tldr|quote|cite|todo|success|check|done)\s?(.*?)\|/, replacement: "|add([!$1] $2)|quote|" },
238
- { regex: /\|quote (\S+)\s?(.*)\|/, replacement: "|add([!$1] $2)|quote|" }
237
+ { regex: /\|(info|note|warning|caution|attention|error|danger|tips|tip|hint|example|abstract|summary|tldr|quote|cite|todo|success|check|done)\s?(.*?)\|/, replacement: "|add([!$1] $2)|addQuote|" },
238
+ { regex: /\|quote (\S+)\s?(.*)\|/, replacement: "|add([!$1] $2)|addQuote|" }
239
239
  // 注意避免和callout语法冲突,以及自身递归
240
240
  ];
241
241
  const ABAlias_json_mdit = [
@@ -537,9 +537,9 @@ class ABConvertManager {
537
537
  }
538
538
  }
539
539
  ABConvert.factory({
540
- id: "quote",
540
+ id: "addQuote",
541
541
  name: "增加引用块",
542
- match: /^(quote|addQuote)$/,
542
+ match: "addQuote",
543
543
  detail: "在文本的每行前面加上 `> `",
544
544
  process_param: ABConvert_IOEnum.text,
545
545
  process_return: ABConvert_IOEnum.text,
@@ -550,23 +550,24 @@ ABConvert.factory({
550
550
  }
551
551
  });
552
552
  ABConvert.factory({
553
- id: "code",
553
+ id: "addCode",
554
554
  name: "增加代码块",
555
- match: /^code(\((.*)\))?$/,
555
+ match: /^(addCode|code)(\((.*)\))?$/,
556
556
  default: "code()",
557
557
  detail: "在文本的前后均加上一行代码块围栏。不加`()`表示用原文本的第一行作为代码类型,括号类型为空表示代码类型为空",
558
558
  process_param: ABConvert_IOEnum.text,
559
559
  process_return: ABConvert_IOEnum.text,
560
560
  process: (el, header, content) => {
561
- let matchs = header.match(/^code(\((.*)\))?$/);
561
+ let matchs = header.match(/^(addCode|code)(\((.*)\))?$/);
562
562
  if (!matchs) return content;
563
- if (matchs[1]) content = matchs[2] + "\n" + content;
563
+ if (matchs[2]) content = matchs[3] + "\n" + content;
564
564
  return "``````" + content + "\n``````";
565
565
  }
566
566
  });
567
- const abc_Xquote = ABConvert.factory({
568
- id: "Xquote",
567
+ const abc_xQuote = ABConvert.factory({
568
+ id: "xQuote",
569
569
  name: "去除引用块",
570
+ match: "/^(xQuote|Xquote)$/",
570
571
  detail: "在文本的每行前面删除 `> `",
571
572
  process_param: ABConvert_IOEnum.text,
572
573
  process_return: ABConvert_IOEnum.text,
@@ -576,20 +577,20 @@ const abc_Xquote = ABConvert.factory({
576
577
  }).join("\n");
577
578
  }
578
579
  });
579
- const abc_Xcode = ABConvert.factory({
580
- id: "Xcode",
580
+ const abc_xCode = ABConvert.factory({
581
+ id: "xCode",
581
582
  name: "去除代码块",
582
- match: /^Xcode(\((true|false|)\))?$/,
583
- default: "Xcode(true)",
583
+ match: /^(xCode|Xcode)(\((true|false|)\))?$/,
584
+ default: "xCode(true)",
584
585
  detail: "参数为是否移除代码类型, Xcode默认为false, Xcode默认为true。记法: code|Xcode 或 code()|Xcode()内容不变",
585
586
  process_param: ABConvert_IOEnum.text,
586
587
  process_return: ABConvert_IOEnum.text,
587
588
  process: (el, header, content) => {
588
- let matchs = header.match(/^Xcode(\((true|false|)\))?$/);
589
+ let matchs = header.match(/^(xCode|Xcode)(\((true|false|)\))?$/);
589
590
  if (!matchs) return content;
590
591
  let remove_flag;
591
- if (matchs[1] == "") remove_flag = false;
592
- else remove_flag = matchs[2] != "false";
592
+ if (matchs[2] == "") remove_flag = false;
593
+ else remove_flag = matchs[3] != "false";
593
594
  let list_content = content.split("\n");
594
595
  let code_flag = "";
595
596
  let line_start = -1;
@@ -618,8 +619,9 @@ const abc_Xcode = ABConvert.factory({
618
619
  }
619
620
  });
620
621
  ABConvert.factory({
621
- id: "X",
622
+ id: "x",
622
623
  name: "去除代码或引用块",
624
+ match: /^(x|X)$/,
623
625
  process_param: ABConvert_IOEnum.text,
624
626
  process_return: ABConvert_IOEnum.text,
625
627
  process: (el, header, content) => {
@@ -633,8 +635,8 @@ ABConvert.factory({
633
635
  break;
634
636
  }
635
637
  }
636
- if (flag == "code") return abc_Xcode.process(el, header, content);
637
- else if (flag == "quote") return abc_Xquote.process(el, header, content);
638
+ if (flag == "code") return abc_xCode.process(el, header, content);
639
+ else if (flag == "quote") return abc_xQuote.process(el, header, content);
638
640
  return content;
639
641
  }
640
642
  });