openzca 0.1.34 → 0.1.35
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/cli.js +36 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -707,6 +707,23 @@ function asThreadType(groupFlag) {
|
|
|
707
707
|
}
|
|
708
708
|
function parseTextStyles(input) {
|
|
709
709
|
const allStyles = [];
|
|
710
|
+
const codeLineIndices = /* @__PURE__ */ new Set();
|
|
711
|
+
{
|
|
712
|
+
const rawLines = input.split("\n");
|
|
713
|
+
const kept = [];
|
|
714
|
+
let inCode = false;
|
|
715
|
+
for (const rawLine of rawLines) {
|
|
716
|
+
if (/^```/.test(rawLine)) {
|
|
717
|
+
inCode = !inCode;
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
if (inCode) {
|
|
721
|
+
codeLineIndices.add(kept.length);
|
|
722
|
+
}
|
|
723
|
+
kept.push(rawLine);
|
|
724
|
+
}
|
|
725
|
+
input = kept.join("\n");
|
|
726
|
+
}
|
|
710
727
|
const escapeMap = [];
|
|
711
728
|
const escaped = input.replace(/\\([*_~#\\{}>+\-])/g, (_match, ch) => {
|
|
712
729
|
const idx = escapeMap.length;
|
|
@@ -718,12 +735,16 @@ function parseTextStyles(input) {
|
|
|
718
735
|
const processedLines = [];
|
|
719
736
|
for (let i = 0; i < lines.length; i++) {
|
|
720
737
|
let line = lines[i];
|
|
721
|
-
|
|
738
|
+
if (codeLineIndices.has(i)) {
|
|
739
|
+
processedLines.push(line);
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
const headingMatch = line.match(/^(#{1,4})\s(.*)$/);
|
|
722
743
|
if (headingMatch) {
|
|
723
744
|
const level = headingMatch[1].length;
|
|
724
745
|
lineStyles.push({ lineIndex: i, style: TextStyle.Bold });
|
|
725
746
|
if (level === 1) lineStyles.push({ lineIndex: i, style: TextStyle.Big });
|
|
726
|
-
else if (level
|
|
747
|
+
else if (level === 3 || level === 4) lineStyles.push({ lineIndex: i, style: TextStyle.Small });
|
|
727
748
|
processedLines.push(headingMatch[2]);
|
|
728
749
|
continue;
|
|
729
750
|
}
|
|
@@ -739,6 +760,10 @@ function parseTextStyles(input) {
|
|
|
739
760
|
indentLevel = Math.max(1, Math.floor(indentContentMatch[1].length / 2));
|
|
740
761
|
content = indentContentMatch[2];
|
|
741
762
|
}
|
|
763
|
+
if (/^[-*+]\s\[[ xX]\]\s/.test(content)) {
|
|
764
|
+
processedLines.push(line);
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
742
767
|
const olMatch = content.match(/^(\d+)\.\s(.*)$/);
|
|
743
768
|
if (olMatch) {
|
|
744
769
|
if (indentLevel > 0) {
|
|
@@ -757,13 +782,17 @@ function parseTextStyles(input) {
|
|
|
757
782
|
processedLines.push(ulMatch[1]);
|
|
758
783
|
continue;
|
|
759
784
|
}
|
|
760
|
-
if (indentLevel > 0) {
|
|
761
|
-
lineStyles.push({ lineIndex: i, style: TextStyle.Indent, indentSize: indentLevel });
|
|
762
|
-
processedLines.push(content);
|
|
763
|
-
continue;
|
|
764
|
-
}
|
|
765
785
|
processedLines.push(line);
|
|
766
786
|
}
|
|
787
|
+
for (const ci of codeLineIndices) {
|
|
788
|
+
if (ci < processedLines.length) {
|
|
789
|
+
processedLines[ci] = processedLines[ci].replace(/[*_~{}]/g, (ch) => {
|
|
790
|
+
const idx = escapeMap.length;
|
|
791
|
+
escapeMap.push(ch);
|
|
792
|
+
return `${idx}`;
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
}
|
|
767
796
|
const inlineInput = processedLines.join("\n");
|
|
768
797
|
const colorMap = {
|
|
769
798
|
red: TextStyle.Red,
|