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.
@@ -210,8 +210,8 @@ function autoABAlias(header, selectorName, content) {
210
210
  return header;
211
211
  }
212
212
  const ABAlias_json_withSub = [
213
- { 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|" },
214
- { regex: /\|quote (\S+)\s?(.*)\|/, replacement: "|add([!$1] $2)|quote|" }
213
+ { 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|" },
214
+ { regex: /\|quote (\S+)\s?(.*)\|/, replacement: "|add([!$1] $2)|addQuote|" }
215
215
  // 注意避免和callout语法冲突,以及自身递归
216
216
  ];
217
217
  const ABAlias_json_mdit = [
@@ -513,9 +513,9 @@ class ABConvertManager {
513
513
  }
514
514
  }
515
515
  ABConvert.factory({
516
- id: "quote",
516
+ id: "addQuote",
517
517
  name: "增加引用块",
518
- match: /^(quote|addQuote)$/,
518
+ match: "addQuote",
519
519
  detail: "在文本的每行前面加上 `> `",
520
520
  process_param: ABConvert_IOEnum.text,
521
521
  process_return: ABConvert_IOEnum.text,
@@ -526,23 +526,24 @@ ABConvert.factory({
526
526
  }
527
527
  });
528
528
  ABConvert.factory({
529
- id: "code",
529
+ id: "addCode",
530
530
  name: "增加代码块",
531
- match: /^code(\((.*)\))?$/,
531
+ match: /^(addCode|code)(\((.*)\))?$/,
532
532
  default: "code()",
533
533
  detail: "在文本的前后均加上一行代码块围栏。不加`()`表示用原文本的第一行作为代码类型,括号类型为空表示代码类型为空",
534
534
  process_param: ABConvert_IOEnum.text,
535
535
  process_return: ABConvert_IOEnum.text,
536
536
  process: (el, header, content) => {
537
- let matchs = header.match(/^code(\((.*)\))?$/);
537
+ let matchs = header.match(/^(addCode|code)(\((.*)\))?$/);
538
538
  if (!matchs) return content;
539
- if (matchs[1]) content = matchs[2] + "\n" + content;
539
+ if (matchs[2]) content = matchs[3] + "\n" + content;
540
540
  return "``````" + content + "\n``````";
541
541
  }
542
542
  });
543
- const abc_Xquote = ABConvert.factory({
544
- id: "Xquote",
543
+ const abc_xQuote = ABConvert.factory({
544
+ id: "xQuote",
545
545
  name: "去除引用块",
546
+ match: "/^(xQuote|Xquote)$/",
546
547
  detail: "在文本的每行前面删除 `> `",
547
548
  process_param: ABConvert_IOEnum.text,
548
549
  process_return: ABConvert_IOEnum.text,
@@ -552,20 +553,20 @@ const abc_Xquote = ABConvert.factory({
552
553
  }).join("\n");
553
554
  }
554
555
  });
555
- const abc_Xcode = ABConvert.factory({
556
- id: "Xcode",
556
+ const abc_xCode = ABConvert.factory({
557
+ id: "xCode",
557
558
  name: "去除代码块",
558
- match: /^Xcode(\((true|false|)\))?$/,
559
- default: "Xcode(true)",
559
+ match: /^(xCode|Xcode)(\((true|false|)\))?$/,
560
+ default: "xCode(true)",
560
561
  detail: "参数为是否移除代码类型, Xcode默认为false, Xcode默认为true。记法: code|Xcode 或 code()|Xcode()内容不变",
561
562
  process_param: ABConvert_IOEnum.text,
562
563
  process_return: ABConvert_IOEnum.text,
563
564
  process: (el, header, content) => {
564
- let matchs = header.match(/^Xcode(\((true|false|)\))?$/);
565
+ let matchs = header.match(/^(xCode|Xcode)(\((true|false|)\))?$/);
565
566
  if (!matchs) return content;
566
567
  let remove_flag;
567
- if (matchs[1] == "") remove_flag = false;
568
- else remove_flag = matchs[2] != "false";
568
+ if (matchs[2] == "") remove_flag = false;
569
+ else remove_flag = matchs[3] != "false";
569
570
  let list_content = content.split("\n");
570
571
  let code_flag = "";
571
572
  let line_start = -1;
@@ -594,8 +595,9 @@ const abc_Xcode = ABConvert.factory({
594
595
  }
595
596
  });
596
597
  ABConvert.factory({
597
- id: "X",
598
+ id: "x",
598
599
  name: "去除代码或引用块",
600
+ match: /^(x|X)$/,
599
601
  process_param: ABConvert_IOEnum.text,
600
602
  process_return: ABConvert_IOEnum.text,
601
603
  process: (el, header, content) => {
@@ -609,8 +611,8 @@ ABConvert.factory({
609
611
  break;
610
612
  }
611
613
  }
612
- if (flag == "code") return abc_Xcode.process(el, header, content);
613
- else if (flag == "quote") return abc_Xquote.process(el, header, content);
614
+ if (flag == "code") return abc_xCode.process(el, header, content);
615
+ else if (flag == "quote") return abc_xQuote.process(el, header, content);
614
616
  return content;
615
617
  }
616
618
  });