@oxecli/oxe 1.0.60 → 1.0.61

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.
Files changed (2) hide show
  1. package/dist/ui.js +6 -3
  2. package/package.json +1 -1
package/dist/ui.js CHANGED
@@ -183,11 +183,14 @@ function highlightCodeLine(line, _lang = "") {
183
183
  }
184
184
  function formatInlineMarkdown(text) {
185
185
  let line = text;
186
+ // Links MUST be converted first: the other rules inject ANSI escape codes,
187
+ // and the link pattern `\[[^\]]+\]\([^)]+\)` would otherwise match the `[`
188
+ // inside an already-inserted escape (e.g. `\x1b[1m`) and corrupt the output.
189
+ line = line.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "\x1b[4;36m$1\x1b[0m \x1b[2m($2)\x1b[0m");
186
190
  line = line.replace(/\*\*\*([^*]+)\*\*\*/g, "\x1b[1;3m$1\x1b[0m");
187
191
  line = line.replace(/\*\*([^*]+)\*\*/g, "\x1b[1m$1\x1b[0m");
188
192
  line = line.replace(/(^|[^\w*])\*([^*\n]+)\*(?=$|[^\w*])/g, "$1\x1b[3m$2\x1b[0m");
189
193
  line = line.replace(/`([^`]+)`/g, "\x1b[1;36m`$1`\x1b[0m");
190
- line = line.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "\x1b[4;36m$1\x1b[0m \x1b[2m($2)\x1b[0m");
191
194
  return line;
192
195
  }
193
196
  // ---------------------------------------------------------------------------
@@ -251,12 +254,12 @@ export function markdownToAnsi(text) {
251
254
  return;
252
255
  const badge = codeLang ? ` \x1b[1;36m${codeLang}\x1b[0m ` : " ";
253
256
  const barLen = Math.max(10, Math.min(width - plainLen(badge) - 4, 60));
254
- out.push(`\x1b[90m┌─${badge}${"─".repeat(barLen)}┐\x1b[0m`);
257
+ out.push(`\x1b[90m╭─${badge}${"─".repeat(barLen)}╮\x1b[0m`);
255
258
  for (const cline of codeBuffer) {
256
259
  const highlighted = highlightCodeLine(cline, codeLang);
257
260
  out.push(`\x1b[90m│\x1b[0m ${highlighted}`);
258
261
  }
259
- out.push(`\x1b[90m└${"─".repeat(barLen + plainLen(badge) + 2)}┘\x1b[0m`);
262
+ out.push(`\x1b[90m╰${"─".repeat(barLen + plainLen(badge) + 2)}╯\x1b[0m`);
260
263
  codeBuffer = [];
261
264
  codeLang = "";
262
265
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxecli/oxe",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },